feat: Add logging
This commit is contained in:
parent
f2e2599561
commit
fef211b2d0
@ -12,6 +12,7 @@ def notify_search_subscribers(adoption_notice: AdoptionNotice, only_if_active :
|
|||||||
If the new adoption notice fits the search subscription, it sends a notification to the user that created the search.
|
If the new adoption notice fits the search subscription, it sends a notification to the user that created the search.
|
||||||
"""
|
"""
|
||||||
if only_if_active and not adoption_notice.is_active:
|
if only_if_active and not adoption_notice.is_active:
|
||||||
|
logging.warning(f"No notifications triggered for adoption notice {adoption_notice} because it's not active.")
|
||||||
return
|
return
|
||||||
for search_subscription in SearchSubscription.objects.all():
|
for search_subscription in SearchSubscription.objects.all():
|
||||||
search = Search(search_subscription=search_subscription)
|
search = Search(search_subscription=search_subscription)
|
||||||
@ -22,6 +23,8 @@ def notify_search_subscribers(adoption_notice: AdoptionNotice, only_if_active :
|
|||||||
adoption_notice=adoption_notice,
|
adoption_notice=adoption_notice,
|
||||||
text=notification_text)
|
text=notification_text)
|
||||||
|
|
||||||
|
logging.info(f"Subscribers for AN {adoption_notice.pk} have been notified")
|
||||||
|
|
||||||
|
|
||||||
class Search:
|
class Search:
|
||||||
def __init__(self, request=None, search_subscription=None):
|
def __init__(self, request=None, search_subscription=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user