From 4ed863827ee31ed638be9b404555c4185d9b44a1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 11 Oct 2023 10:36:58 +0300 Subject: CaseAttribute: Save diff to db at queue time. --- gn3/case_attributes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py index 2ff23e2..f2419de 100644 --- a/gn3/case_attributes.py +++ b/gn3/case_attributes.py @@ -247,7 +247,9 @@ def __queue_diff__(conn: Connection, diff_data, diff_data_dir: Path) -> Path: f"{created.isoformat()}.json") with open(filepath, "w", encoding="utf8") as diff_file: # We want this to fail if the metadata items below are not provided. - diff_file.write(json.dumps({**diff_data, "created": created.isoformat()})) + the_diff = {**diff_data, "created": created.isoformat()} + insert_id = __save_diff__(conn, the_diff, EditStatus.review) + diff_file.write(json.dumps({**the_diff, "db_id": insert_id})) return filepath raise NoDiffError -- cgit 1.4.1