FIX(promotions): default event status promotion_amount to 0 #2

Merged
Ghasemi merged 3 commits from feature/allow-users into master 2026-08-03 11:04:18 -04:00
Collaborator

get_event_status_for_user returned None whenever the event was
already processed, no plan matched, or the user lacked access to the
recipient. Callers now always get a concrete amount: the real payout
if accessible, 0 otherwise.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

get_event_status_for_user returned None whenever the event was already processed, no plan matched, or the user lacked access to the recipient. Callers now always get a concrete amount: the real payout if accessible, 0 otherwise. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ali added 1 commit 2026-08-03 10:04:40 -04:00
get_event_status_for_user returned None whenever the event was
already processed, no plan matched, or the user lacked access to the
recipient. Callers now always get a concrete amount: the real payout
if accessible, 0 otherwise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ali added 1 commit 2026-08-03 10:36:59 -04:00
Checking each recipient via Recipient.is_user_allowed() inside the
loop issued one AllowedUser query per restricted recipient (N+1).
Fetch all matching AllowedUser rows for the plan's recipients in a
single query up front instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ali added 1 commit 2026-08-03 10:51:34 -04:00
Fold the restricted-recipient access check into the recipients
queryset itself via Q(public OR restricted-and-allowed), joining
against AllowedUser instead of running a separate lookup query.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Ghasemi merged commit 1a63acee32 into master 2026-08-03 11:04:18 -04:00
Ghasemi deleted branch feature/allow-users 2026-08-03 11:04:18 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: addwin/promotions#2
No description provided.