From 2824a0cb7f7ae3fab6b210d857c6c480fa9b5806 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 4 Jan 2022 13:24:24 +0300 Subject: Insert data to db by checking the tracked deletions, mods, or adds Prior to this, we only checked for the json files with contained the modifications. However, in the case of double deletions, and double inserts, the data would have been stored in the db anyway; which is a false representation of changes. --- wqflask/wqflask/metadata_edits.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 5b2b1e1d..1f8283f7 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -523,13 +523,14 @@ def approve_data(resource_id:str, file_name: str): value=value, error=se, count=count) - - if any([any(modifications), any(deletions), any(insertions)]): if __insertions: n_insertions += 1 # Remove any data that already exists from sample_data inserts else: sample_data.get("Additions").remove(insertion) + if any([sample_data.get("Additions"), + sample_data.get("Modifications"), + sample_data.get("Deletions")]): insert(conn, table="metadata_audit", data=MetadataAudit( -- cgit v1.2.3