Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the send to get data for notification_count_for_the_year #2029

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

jzbahrai
Copy link
Contributor

@jzbahrai jzbahrai commented Jan 2, 2025

Summary | Résumé

When we get the monthly notification count, we need the count for this current fiscal year.
The code was previously sending "2025" as the year to get the monthly data information, instead
in the time period april 2024 - march 2025, we need to call the monthly_stats function with "2024".

Testing:

I tested this locally, and I am sending the correct data.

Release plan

Release this to production, and then manually test the change to see if templates can be fetched.

Copy link

github-actions bot commented Jan 2, 2025

@jzbahrai jzbahrai force-pushed the task/fix-data-send branch from 1ccafbb to 5e3977e Compare January 2, 2025 21:30
Copy link
Contributor

@smcmurtry smcmurtry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to reproduce the bug locally by doing the following on the main branches of admin and api:

  • create a new template
  • upload a csv via the admin interface and do a bulk send
  • visit the template page that was used for the send
  • observe the 500 error page: Sorry, we’re experiencing technical difficulties Try again later. and on the api:
    data[month][row.notification_type][row.notification_status] += row.count
KeyError: '2025-01'

Then I check out Jumana's branch and refresh the page, and I no longer see an error.

This change has the side effect of making the annual limits apply to the financial year and not the calendar year, which is what we want.

Looks good!

Copy link
Member

@andrewleith andrewleith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -83,8 +82,10 @@ def get_limit_stats(self, service: Service):
}
"""

current_financial_year = get_current_financial_year()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep my bad, I was passing the current year here where it should have been fiscal. Thanks and sorry for the alarms 😞

@jzbahrai jzbahrai merged commit 99133d9 into main Jan 6, 2025
11 checks passed
@jzbahrai jzbahrai deleted the task/fix-data-send branch January 6, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants