-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add annual limits to dashboard and usage reports (#1989)
* feat: add client to fetch and cache annual usage for a given service * feat(dashboard): fetch and use annual send counts on the dashboard * chore: undo new client class * feat(service_api_client): get annual data excluding today and cache it for use in the dashboard * chore: formatting (why is this still happening?!?!) * feat(dashboard): display annual data on dashboard (cached); show aggregates at top of usage report page * chore: translations * test(dashboard): add a mock for annual stats whenever dashboard is tested * chore: formatting * chore: remove duplicate translation * chore: default `FF_ANNUAL_LIMITS` to true for staging config * fix: only show new ui related to annual limits if `FF_ANNUAL_LIMIT` is true * chore: update utils * chore: use annual_limit_client to get cached stats for today * feat: cache the result of get_monthly_notification_stats * chore: translation * feat(dashboard): get daily data from redis where possible and aggregate with monthly sources * test: add testids * chore(service_api_client): cache call * test: add tests for dashboard and usage report changes * chore: regen poetry lock * fix: align with data structure in annual_limits client * chore: bump utils * chore: add TODO around caching for when API is updated * chore: fix failing tests * chore: formtting * chore: update poetry.lock * chore: fix tests * debug: add logging stmt to see whats going wrong in staging * chore: fix loggin stmt * chore: log properly? maybe? 😱 * fix: add some missing node checks to dail limits redis structure to ensure code does error out * fix: mistakenly trying to use redis data in "db" mode, run formatting * fix: remove "notifications" node on redis data, as it isnt there after all * tests: update data format to align with redis annual_limit client * fix: use explicit timezone * Default the FF to OFF if it isnt in the ENV vars
- Loading branch information
1 parent
4b4ac2b
commit 00ecbe9
Showing
13 changed files
with
486 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% from "components/big-number.html" import big_number %} | ||
{% from "components/message-count-label.html" import message_count_label %} | ||
{% from 'components/remaining-messages.html' import remaining_messages %} | ||
{% from "components/show-more.html" import show_more %} | ||
|
||
<div class="ajax-block-container" data-testid="annual-usage"> | ||
<h2 class="heading-medium mt-8"> | ||
{{ _('Annual usage') }} | ||
<br /> | ||
<small class="text-gray-600 text-small font-normal" style="color: #5E6975"> | ||
{% set current_year = current_year or (now().year if now().month < 4 else now().year + 1) %} | ||
{{ _('resets on April 1, ') ~ current_year }} | ||
</small> | ||
</h2> | ||
<div class="grid-row contain-floats mb-10"> | ||
<div class="{{column_width}}"> | ||
{{ remaining_messages(header=_('emails'), total=current_service.email_annual_limit, used=statistics_annual['email'], muted=true) }} | ||
</div> | ||
<div class="{{column_width}}"> | ||
{{ remaining_messages(header=_('text messages'), total=current_service.sms_annual_limit, used=statistics_annual['sms'], muted=true) }} | ||
</div> | ||
</div> | ||
{{ show_more(url_for('.monthly', service_id=current_service.id), _('Visit usage report')) }} | ||
</div> | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.