aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-10-11 10:36:58 +0300
committerFrederick Muriuki Muriithi2023-10-11 10:38:54 +0300
commit4ed863827ee31ed638be9b404555c4185d9b44a1 (patch)
tree353f01e3f5c26032b48e8a4ae6964b6547c7b544
parent2b198c181264587fbd12f6b19b4ffec5711b977e (diff)
downloadgenenetwork3-4ed863827ee31ed638be9b404555c4185d9b44a1.tar.gz
CaseAttribute: Save diff to db at queue time.
-rw-r--r--gn3/case_attributes.py4
1 files changed, 3 insertions, 1 deletions
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