From 773645a908068d0f6e20550a1559041585119560 Mon Sep 17 00:00:00 2001 From: cal-nic Date: Wed, 15 May 2024 15:29:44 +0100 Subject: [PATCH] fix: add call number/dial number/busy dials to key --- data_sources/call_history_data.py | 4 ++-- tests/data_sources/test_datastore_data.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data_sources/call_history_data.py b/data_sources/call_history_data.py index ccca46b..93151e8 100644 --- a/data_sources/call_history_data.py +++ b/data_sources/call_history_data.py @@ -150,7 +150,7 @@ def __bulk_upload_call_history(self, new_call_history_entries): task1 = datastore.Entity( client.key( "CallHistory", - f"{call_history_record.questionnaire_name}-{call_history_record.serial_number}-{call_history_record.call_start_time}", + f"{call_history_record.call_number}-{call_history_record.dial_number}-{call_history_record.busy_dials}-{call_history_record.questionnaire_name}-{call_history_record.serial_number}-{call_history_record.call_start_time}", ) ) task1.update(asdict(call_history_record)) @@ -176,6 +176,6 @@ def __check_if_call_history_record_already_exists( call_history_record, current_call_history_in_datastore ): return ( - f"{call_history_record.questionnaire_name}-{call_history_record.serial_number}-{call_history_record.call_start_time}" + f"{call_history_record.call_number}-{call_history_record.dial_number}-{call_history_record.busy_dials}-{call_history_record.questionnaire_name}-{call_history_record.serial_number}-{call_history_record.call_start_time}" in current_call_history_in_datastore ) diff --git a/tests/data_sources/test_datastore_data.py b/tests/data_sources/test_datastore_data.py index 7844097..57f5514 100644 --- a/tests/data_sources/test_datastore_data.py +++ b/tests/data_sources/test_datastore_data.py @@ -146,7 +146,7 @@ def test_get_cati_call_history(mock_get_cati_call_history_from_database): def test_filter_out_existing_call_history_records( mock_call_history_keys, ): - mock_call_history_keys.return_value = {"OPN2101A-1001011-2021/05/19 14:59:01": None} + mock_call_history_keys.return_value = {"1-1-0-OPN2101A-1001011-2021/05/19 14:59:01": None} call_history_data = [ CallHistory(