aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2022-01-04 13:26:19 +0300
committerBonfaceKilz2022-01-05 17:05:41 +0300
commitdd8a1678b4de4b5e280b2df1053fe287e2cc6e86 (patch)
treefb6d4d6aa7deaf8f3a6302175864dd9d0bef2fac /wqflask
parent2824a0cb7f7ae3fab6b210d857c6c480fa9b5806 (diff)
downloadgenenetwork2-dd8a1678b4de4b5e280b2df1053fe287e2cc6e86.tar.gz
Display correct message on the # of edits
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/metadata_edits.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index 1f8283f7..33e769ca 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -541,10 +541,19 @@ def approve_data(resource_id:str, file_name: str):
os.rename(os.path.join(f"{TMPDIR}/sample-data/diffs", file_name),
os.path.join(f"{TMPDIR}/sample-data/diffs",
f"{file_name}.approved"))
- flash((f"Just updated data from: {file_name};\n"
- f"# Modifications: {len(modifications)}; "
- f"# Additions: {len(insertions)}; "
- f"# Deletions: {len(deletions)}"),
- "success")
+ message = ""
+ if n_deletions:
+ flash(f"# Deletions: {n_deletions}", "success")
+ if n_insertions:
+ flash("# Additions: {len(modifications)", "success")
+ if len(modifications):
+ flash("# Modifications: {len(modifications)}", "success")
+ else: # Edge case where you need to automatically reject the file
+ os.rename(os.path.join(f"{TMPDIR}/sample-data/diffs", file_name),
+ os.path.join(f"{TMPDIR}/sample-data/diffs",
+ f"{file_name}.rejected"))
+ flash(("Automatically rejecting this file since no "
+ "changes could be applied."), "warning")
+
return redirect(url_for('metadata_edit.list_diffs'))