Skip to content

Commit 2602534

Browse files
authored
Merge pull request #759 from NHSDigital/remove-aggregate-report
Remove aggregate report
2 parents ee8823e + 7646ee2 commit 2602534

File tree

4 files changed

+6
-290
lines changed

4 files changed

+6
-290
lines changed

manage_breast_screening/notifications/management/commands/create_reports.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,13 @@ class Command(BaseCommand):
4343

4444
BSO_CODES = ["MBD"]
4545
REPORTS = [
46-
ReportConfig("aggregate", ["3 months"], True),
4746
ReportConfig(
4847
"invites-not-sent", [datetime.now(tz=ZONE_INFO).date()], True, "failures"
4948
),
50-
ReportConfig("reconciliation", [datetime.now(tz=ZONE_INFO).date()], True),
49+
ReportConfig("reconciliation", ["3 months"], True),
5150
]
5251
SMOKE_TEST_BSO_CODE = "SM0K3"
53-
SMOKE_TEST_CONFIG = ReportConfig(
54-
"reconciliation", [datetime.now(tz=ZONE_INFO).date()], False
55-
)
52+
SMOKE_TEST_CONFIG = ReportConfig("reconciliation", ["1 week"], False)
5653

5754
def add_arguments(self, parser):
5855
parser.add_argument("--smoke-test", action="store_true")

manage_breast_screening/notifications/queries/aggregate.sql

Lines changed: 0 additions & 40 deletions
This file was deleted.

manage_breast_screening/notifications/tests/management/commands/test_create_reports.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,21 @@ def test_handle_creates_all_reports(self, dataframe, csv_data, now):
5656

5757
mock_read_sql, mock_blob_storage, mock_email_service = md
5858

59-
assert mock_read_sql.call_count == 3
60-
assert mock_blob_storage.add.call_count == 3
59+
assert mock_read_sql.call_count == 2
60+
assert mock_blob_storage.add.call_count == 2
6161
assert mock_email_service.send_reports_email.call_count == 1
6262

6363
for bso_code in Command.BSO_CODES:
64-
mock_read_sql.assert_any_call(
65-
Helper.sql("aggregate"), connection, params=["3 months", bso_code]
66-
)
6764
mock_read_sql.assert_any_call(
6865
Helper.sql("failures"), connection, params=[now.date(), bso_code]
6966
)
7067
mock_read_sql.assert_any_call(
71-
Helper.sql("reconciliation"), connection, params=[now.date(), bso_code]
68+
Helper.sql("reconciliation"), connection, params=["3 months", bso_code]
7269
)
7370

74-
aggregate_filename = (
75-
f"{now.strftime('%Y-%m-%dT%H:%M:%S')}-{bso_code}-aggregate-report.csv"
76-
)
7771
failures_filename = f"{now.strftime('%Y-%m-%dT%H:%M:%S')}-{bso_code}-invites-not-sent-report.csv"
7872
reconciliation_filename = f"{now.strftime('%Y-%m-%dT%H:%M:%S')}-{bso_code}-reconciliation-report.csv"
7973

80-
mock_blob_storage.add.assert_any_call(
81-
aggregate_filename,
82-
csv_data,
83-
content_type="text/csv",
84-
)
8574
mock_blob_storage.add.assert_any_call(
8675
failures_filename,
8776
csv_data,
@@ -95,7 +84,6 @@ def test_handle_creates_all_reports(self, dataframe, csv_data, now):
9584

9685
mock_email_service.send_reports_email.assert_called_once_with(
9786
{
98-
aggregate_filename: csv_data,
9987
failures_filename: csv_data,
10088
reconciliation_filename: csv_data,
10189
}
@@ -142,7 +130,7 @@ def test_smoke_test_argument_uses_correct_configuration(
142130
mock_read_sql, mock_blob_storage, mock_email_service = md
143131

144132
mock_read_sql.assert_called_once_with(
145-
Helper.sql("reconciliation"), connection, params=[now.date(), "SM0K3"]
133+
Helper.sql("reconciliation"), connection, params=["1 week", "SM0K3"]
146134
)
147135
mock_blob_storage.add.assert_called_once_with(
148136
"SM0K3-reconciliation-report.csv",

manage_breast_screening/notifications/tests/queries/test_aggregate_query.py

Lines changed: 0 additions & 229 deletions
This file was deleted.

0 commit comments

Comments
 (0)