Merge pull request #3939 from alphagov/check-daily-limit-for-csv-uploads

Check the daily limit get the daily notification_count from redis.
This commit is contained in:
Rebecca Law
2021-06-29 14:41:22 +01:00
committed by GitHub
6 changed files with 23 additions and 39 deletions

View File

@@ -272,7 +272,6 @@ def get_notifications(service_id, message_type, status_override=None):
message_type,
service_api_client.get_service_statistics(
service_id,
today_only=False,
limit_days=service_data_retention_days
)
)

View File

@@ -612,8 +612,8 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
if e.status_code != 404:
raise
statistics = service_api_client.get_service_statistics(service_id, today_only=True)
remaining_messages = (current_service.message_limit - sum(stat['requested'] for stat in statistics.values()))
notification_count = service_api_client.get_notification_count(service_id)
remaining_messages = (current_service.message_limit - notification_count)
contents = s3download(service_id, upload_id)