aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-12-22 15:34:18 +0300
committerBonfaceKilz2022-01-05 17:05:41 +0300
commit4362e738f604e71e9482f832fa744631925fd1f6 (patch)
treeceebebe257242022992318ef28e1b07fb7932acc /wqflask
parenta2941c93c724a1536e388fb45579524c61fb0441 (diff)
downloadgenenetwork2-4362e738f604e71e9482f832fa744631925fd1f6.tar.gz
metadata_edits: Return early if uploaded csv has not been edited
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/metadata_edits.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index e0ceaf03..c8e73eec 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -259,6 +259,13 @@ def update_phenotype(dataset_id: str, name: str):
r = run_cmd(cmd=("csvdiff "
f"'{uploaded_file_name}' '{new_file_name}' "
"--format json"))
+
+ # Edge case where the csv file has not been edited!
+ if not any(json.loads(r.get("output")).values()):
+ flash(f"You have not modified the csv file you downloaded!",
+ "warning")
+ return redirect(f"/datasets/{dataset_id}/traits/{name}"
+ f"?resource-id={request.args.get('resource-id')}")
diff_output = (f"{TMPDIR}/sample-data/diffs/"
f"{_file_name}.json")
with open(diff_output, "w") as f: