about summary refs log tree commit diff
path: root/qc_app/upload
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-09 17:27:14 +0300
committerFrederick Muriuki Muriithi2024-02-12 18:17:40 +0300
commita0d3ac85dab5bfba9107f63b3219902ebe32cdd9 (patch)
tree83a3a7e8e6d8d4b2ea2d5481cb07aa5e32f71ff7 /qc_app/upload
parentb7eb549bb02eaba22ba06b0ddf5d04c9b4fe0f66 (diff)
downloadgn-uploader-a0d3ac85dab5bfba9107f63b3219902ebe32cdd9.tar.gz
UI: Provide QC successful results page
Diffstat (limited to 'qc_app/upload')
-rw-r--r--qc_app/upload/rqtl2.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py
index c20bd8f..4b00891 100644
--- a/qc_app/upload/rqtl2.py
+++ b/qc_app/upload/rqtl2.py
@@ -183,7 +183,8 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
                     {"job-metadata": json.dumps({
                         "speciesid": species_id,
                         "populationid": population_id,
-                        "rqtl2-bundle-file": str(the_file.absolute())})}),
+                        "rqtl2-bundle-file": str(the_file.absolute()),
+                        "original-filename": request.files["rqtl2_bundle_file"].filename})}),
                 redisuri,
                 f"{app.config['UPLOAD_FOLDER']}/job_errors")
             return redirect(url_for(
@@ -193,7 +194,8 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
              methods=["GET", "POST"])
 def rqtl2_bundle_qc_status(jobid: UUID):
     """Check the status of the QC jobs."""
-    with Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn:
+    with (Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn,
+          database_connection(app.config["SQL_URI"]) as dbconn):
         try:
             thejob = jobs.job(rconn, jobs.jobsnamespace(), jobid)
             messagelistname = thejob.get("log-messagelist")
@@ -207,9 +209,15 @@ def rqtl2_bundle_qc_status(jobid: UUID):
                                            thejob.get("errors-generic", "[]")),
                                        messages=logmessages)
             if jobstatus == "success":
-                return render_template("rqtl2/rqtl2-qc-job-results.html",
-                                       job=thejob,
-                                       messages=logmessages)
+                jobmeta = json.loads(thejob["job-metadata"])
+                species = species_by_id(dbconn, jobmeta["speciesid"])
+                return render_template(
+                    "rqtl2/rqtl2-qc-job-results.html",
+                    species=species,
+                    population=population_by_species_and_id(
+                        dbconn, species["SpeciesId"], jobmeta["populationid"]),
+                    rqtl2bundle=Path(jobmeta["rqtl2-bundle-file"]),
+                    rqtl2bundleorig=jobmeta["original-filename"])
 
             return render_template("rqtl2/rqtl2-qc-job-status.html",
                                    job=thejob,