From d809997e8ca76d2441b58693078c6c9698e769bb Mon Sep 17 00:00:00 2001
From: Frederick Muriuki Muriithi
Date: Tue, 16 Jan 2024 12:38:30 +0300
Subject: Create intermediate step
We do not have the option to modify the request and then redirect with
the modification in place. To go around that, this commit creates an
intermediate step that informs the user of their progress, while
allowing us to store the filename for future steps.
---
.../rqtl2/upload-rqtl2-bundle-step-01.html | 44 ++++++++++++++++++++++
qc_app/templates/rqtl2/upload-rqtl2-bundle.html | 44 ----------------------
qc_app/upload/rqtl2.py | 8 +++-
3 files changed, 50 insertions(+), 46 deletions(-)
create mode 100644 qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html
delete mode 100644 qc_app/templates/rqtl2/upload-rqtl2-bundle.html
diff --git a/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html b/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html
new file mode 100644
index 0000000..6491e6b
--- /dev/null
+++ b/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html
@@ -0,0 +1,44 @@
+{%extends "base.html"%}
+{%from "flash_messages.html" import flash_messages%}
+
+{%block title%}Upload R/qtl2 Bundle{%endblock%}
+
+{%block contents%}
+
Upload R/qtl2 Bundle
+
+
+
+{%endblock%}
diff --git a/qc_app/templates/rqtl2/upload-rqtl2-bundle.html b/qc_app/templates/rqtl2/upload-rqtl2-bundle.html
deleted file mode 100644
index 6491e6b..0000000
--- a/qc_app/templates/rqtl2/upload-rqtl2-bundle.html
+++ /dev/null
@@ -1,44 +0,0 @@
-{%extends "base.html"%}
-{%from "flash_messages.html" import flash_messages%}
-
-{%block title%}Upload R/qtl2 Bundle{%endblock%}
-
-{%block contents%}
-Upload R/qtl2 Bundle
-
-
-
-{%endblock%}
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py
index d60ea65..0eca6ae 100644
--- a/qc_app/upload/rqtl2.py
+++ b/qc_app/upload/rqtl2.py
@@ -132,7 +132,7 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
if request.method == "GET" or (
request.method == "POST"
and bool(request.args.get("pgsrc"))):
- return render_template("rqtl2/upload-rqtl2-bundle.html",
+ return render_template("rqtl2/upload-rqtl2-bundle-step-01.html",
species=species,
population=population)
@@ -150,7 +150,11 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
try:
with ZipFile(str(the_file), "r") as zfile:
r_qtl2.validate_bundle(zfile)
- return "WOULD PROCESS THE BUNDLE..."
+ return render_template(
+ "rqtl2/upload-rqtl2-bundle-step-02.html",
+ species=species,
+ population=population,
+ rqtl2_bundle_file=the_file.name)
except (InvalidFormat, __RequestError__) as exc:
flash("".join(exc.args), "alert-error alert-danger error-rqtl2")
return this_page_with_errors
--
cgit v1.2.3