aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2022-01-04 13:24:24 +0300
committerBonfaceKilz2022-01-05 17:05:41 +0300
commit2824a0cb7f7ae3fab6b210d857c6c480fa9b5806 (patch)
tree886922b7bd595c0ef3fdbb4e145771b75bfe5303
parent97ca71becd68ed24cd685f359dbe7fc10ffb5bda (diff)
downloadgenenetwork2-2824a0cb7f7ae3fab6b210d857c6c480fa9b5806.tar.gz
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.
-rw-r--r--wqflask/wqflask/metadata_edits.py5
1 files 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(