principal subscription query 2
This commit is contained in:
@@ -24,6 +24,11 @@ class OneWeekSubscriptionAlertView(APIView):
|
||||
eligible_principals = self.eligible_principals()
|
||||
|
||||
for principal in eligible_principals:
|
||||
try:
|
||||
player_id = principal.principal.player_id
|
||||
except AttributeError:
|
||||
# Handle the case where principal is null or does not have a player_id field
|
||||
continue
|
||||
notification_title = "Subscription Expiry Reminder"
|
||||
notification_message = "Your subscription is going to expire in a week."
|
||||
notification_category = NotificationCategoryChoices.SUBSCRIPTION
|
||||
@@ -32,7 +37,7 @@ class OneWeekSubscriptionAlertView(APIView):
|
||||
notification_payload = {
|
||||
"headings": {"en": notification_title},
|
||||
"contents": {"en": notification_message},
|
||||
"include_player_ids": [principal.player_id],
|
||||
"include_player_ids": [player_id],
|
||||
}
|
||||
response = self.client.send_notification(notification_payload)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user