diff options
author | BonfaceKilz | 2021-12-22 15:34:18 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-01-05 17:05:41 +0300 |
commit | 4362e738f604e71e9482f832fa744631925fd1f6 (patch) | |
tree | ceebebe257242022992318ef28e1b07fb7932acc | |
parent | a2941c93c724a1536e388fb45579524c61fb0441 (diff) | |
download | genenetwork2-4362e738f604e71e9482f832fa744631925fd1f6.tar.gz |
metadata_edits: Return early if uploaded csv has not been edited
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 7 |
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: |