feat: write a job to send email to admin for recent opened learner cr…#822
Open
jajjibhai008 wants to merge 1 commit intomainfrom
Open
feat: write a job to send email to admin for recent opened learner cr…#822jajjibhai008 wants to merge 1 commit intomainfrom
jajjibhai008 wants to merge 1 commit intomainfrom
Conversation
ba33cad to
0e41476
Compare
jajjibhai008
commented
Aug 25, 2025
| """ | ||
|
|
||
| subsidy_model = apps.get_model('subsidy_request.LearnerCreditRequest') | ||
| subsidy_requests = subsidy_model.objects.filter( |
Contributor
Author
There was a problem hiding this comment.
[Reason for re-query] The task is re-queried at execution time. Between enqueue and run, requests can be approved/closed or new ones arrive. If we “pass data” and skip the task’s query, we risk sending stale/empty or incorrect digests, and Celery retries would use outdated payloads.
0e41476 to
f037af3
Compare
zamanafzal
approved these changes
Aug 25, 2025
sameenfatima78
approved these changes
Aug 26, 2025
| tasks_enqueued = 0 | ||
|
|
||
| for policy in policies_qs.iterator(): | ||
| total_policies += 1 |
Member
There was a problem hiding this comment.
this can be handled outside the loop with policies_qs.count()
Contributor
Author
There was a problem hiding this comment.
policies_qs.count() runs a separate SELECT COUNT(*) query, which is why I am not using it. [Reason for current approach] We already iterate policies_qs to do the per-policy check, incrementing total_policies inside that loop costs nothing extra.
...rise_access/apps/subsidy_request/management/commands/send_learner_credit_bnr_daily_digest.py
Outdated
Show resolved
Hide resolved
f037af3 to
9ad8f6b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
JIRA-> ENT-10731
Job scheduled PR(only stage): https://github.com/edx/edx-internal/pull/13234
Jira:
ENT-XXXX
Merge checklist:
./manage.py makemigrationshas been runPost merge: