Skip to content

Commit

Permalink
Tracking pull request to merge emergency release-1.9.0.1 to main (#272)
Browse files Browse the repository at this point in the history
* update to 1.10.0

* Update to 1.9.0-1

* django-q-settings-and-mass-email (#271)

* update to 1.10.0

* django-q-settings-and-mass-email

Co-authored-by: Kuan Fan <[email protected]>

Co-authored-by: tim738745 <[email protected]>
  • Loading branch information
kuanfandevops and tim738745 authored Aug 24, 2022
1 parent 0fd0b8e commit 8ae77b7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
2 changes: 2 additions & 0 deletions django/api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ def ready(self):
schedule_get_ncda_redeemed_rebates,
schedule_cancel_untouched_household_applications,
schedule_expire_expired_applications,
schedule_send_mass_approval_email_once,
)

if settings.RUN_JOBS and "qcluster" in sys.argv:
schedule_send_rebates_to_ncda()
schedule_get_ncda_redeemed_rebates()
schedule_cancel_untouched_household_applications()
schedule_expire_expired_applications()
schedule_send_mass_approval_email_once()


class ITVRAdminConfig(AdminConfig):
Expand Down
12 changes: 12 additions & 0 deletions django/api/scheduled_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ def schedule_expire_expired_applications():
)
except IntegrityError:
pass


def schedule_send_mass_approval_email_once():
try:
schedule(
"api.tasks.send_mass_approval_email_once",
name="send_mass_approval_email_once",
schedule_type="O",
repeats=1,
)
except IntegrityError:
pass
4 changes: 2 additions & 2 deletions django/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@
Q_CLUSTER = {
"name": "ITVR",
"workers": 4,
"timeout": 90,
"retry": 120,
"timeout": 1200,
"retry": 1260,
"queue_limit": 50,
"bulk": 10,
"orm": "default",
Expand Down
20 changes: 20 additions & 0 deletions django/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,23 @@ def expire_expired_applications():
status=GoElectricRebateApplication.Status.EXPIRED,
modified=timezone.now(),
)


def send_mass_approval_email_once():
rebates = GoElectricRebate.objects.filter(ncda_id__isnull=False)
approved_applications = []
for rebate in rebates:
application = rebate.application
if application and (
application.status == GoElectricRebateApplication.Status.APPROVED
):
application.rebate_amount = rebate.rebate_max_amount
approved_applications.append(application)

for application in approved_applications:
async_task(
"api.tasks.send_approve",
application.email,
application.id,
application.rebate_amount,
)
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "1.9.0",
"version": "1.9.0-1",
"private": true,
"dependencies": {
"@date-io/date-fns": "^2.14.0",
Expand Down

0 comments on commit 8ae77b7

Please sign in to comment.