Skip to content

Commit

Permalink
fix(dashboard): update check to see if redis has today's data (#2017)
Browse files Browse the repository at this point in the history
* fix(dashboard): update check to see if redis has today's data

* fix: update test for redis has no data
  • Loading branch information
andrewleith authored Dec 10, 2024
1 parent 51b10a9 commit ff236cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/main/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def aggregate_by_type(notification_data):
todays_data = annual_limit_client.get_all_notification_counts(current_service.id)

# if redis is empty, query the db
if todays_data is None:
if all(value == 0 for value in todays_data.values()):
todays_data = service_api_client.get_service_statistics(service_id, limit_days=1, today_only=False)
annual_data_aggregate = combine_daily_to_annual(todays_data, annual_data, "db")

Expand Down
2 changes: 1 addition & 1 deletion tests/app/main/views/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ def test_usage_report_aggregates_calculated_properly_without_redis(
# mock annual_limit_client.get_all_notification_counts
mocker.patch(
"app.main.views.dashboard.annual_limit_client.get_all_notification_counts",
return_value=None,
return_value={"sms_delivered": 0, "email_delivered": 0, "sms_failed": 0, "email_failed": 0},
)

mocker.patch(
Expand Down

0 comments on commit ff236cc

Please sign in to comment.