From 366c9c433a0b18db25f5cb28d7c7dc1ed17b3c67 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 2 Aug 2021 21:46:07 +0300
Subject: Display a flash message after a file(and data) approval
squash! Display a flash message after a file(and data) approval
---
wqflask/wqflask/templates/display_files.html | 9 +++++++++
wqflask/wqflask/views.py | 6 +++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/wqflask/wqflask/templates/display_files.html b/wqflask/wqflask/templates/display_files.html
index 30974300..f8bc188f 100644
--- a/wqflask/wqflask/templates/display_files.html
+++ b/wqflask/wqflask/templates/display_files.html
@@ -2,6 +2,15 @@
{% block title %}Trait Submission{% endblock %}
{% block content %}
+{% with messages = get_flashed_messages(with_categories=true) %}
+{% if messages %}
+{% for category, message in messages %}
+
+{% endfor %}
+{% endif %}
+{% endwith %}
Show files for approval
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index c7582782..11c8b347 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1414,12 +1414,13 @@ def approve_data(name):
sample_data = json.load(myfile)
PUBLISH_ID = sample_data.get("publishdata_id")
modifications = [d for d in sample_data.get("Modifications")]
+ row_counts = len(modifications)
for modification in modifications:
if modification.get("Current"):
(strain_id,
strain_name,
value, se, count) = modification.get("Current").split(",")
- row_counts = update_sample_data(
+ update_sample_data(
conn=conn,
strain_name=strain_name,
strain_id=int(strain_id),
@@ -1439,6 +1440,9 @@ def approve_data(name):
os.rename(os.path.join("/tmp/sample-data/diffs", name),
os.path.join("/tmp/sample-data/diffs",
f"{name}.approved"))
+ flash((f"Just updated data from: {name}; {row_counts} "
+ "row(s) modified!"),
+ "success")
return redirect("/admin/data-sample/diffs/")
--
cgit v1.2.3