Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3567 +/- ##
==========================================
+ Coverage 86.12% 86.30% +0.18%
==========================================
Files 65 65
Lines 7576 7655 +79
Branches 712 715 +3
==========================================
+ Hits 6525 6607 +82
+ Misses 799 798 -1
+ Partials 252 250 -2 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a per-customer setting to send one additional “upcoming payment” notification N days before expiry, and adjusts the recurring payments notifier to consider these earlier notifications.
Changes:
- Add
Customer.upcoming_payment_notification_dayswith a max-value validator and CRM display. - Extend
Donation.should_notify()andSubscription.should_notify()to trigger on the customer-configured day offset. - Update
recurring_paymentscommand logic and add tests covering extra notification behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
weblate_web/payments/models.py |
Adds the new customer field and validation for configurable notification lead time. |
weblate_web/payments/migrations/0057_customer_upcoming_payment_notification_days.py |
Persists the new field in the DB schema. |
weblate_web/models.py |
Uses the new field to decide whether to notify for donations/subscriptions. |
weblate_web/management/commands/recurring_payments.py |
Expands the expiry scan window based on the maximum configured customer lead time and tweaks summary inclusion. |
weblate_web/tests.py |
Adds validation and behavior tests for the new notification timing. |
weblate_web/crm/templates/payments/customer_detail.html |
Displays the configured extra notification period on the customer detail page. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
weblate_web/payments/migrations/0057_customer_upcoming_payment_notification_days.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
weblate_web/management/commands/recurring_payments.py:69
expires_notifyis now extended to the maximumupcoming_payment_notification_daysacross all customers, which makes the command load and iterate over every subscription/donation expiring within that maximum window (up to 90 days) even though only a small subset will actually matchshould_notify(timestamp)on a given run. This can significantly increase runtime on large datasets once any customer sets a large value. Consider querying the default 31-day window as before and adding a separate, narrower query for customers with non-zero extra days (e.g., per distinct extra-day value or by filtering to expiries exactlytimestamp + extra_days) so the command doesn’t scan the whole max window each time.
summary_notify = timestamp + timedelta(days=31)
customer_notification_days = (
Customer.objects.aggregate(Max("upcoming_payment_notification_days"))[
"upcoming_payment_notification_days__max"
]
or 0
)
expires_notify = timestamp + timedelta(days=max(31, customer_notification_days))
# Expiring subscriptions
subscriptions = Subscription.objects.filter(
expires__lte=expires_notify, enabled=True
).exclude(payment=None)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.