diff options
author | Frederick Muriuki Muriithi | 2022-06-02 09:58:05 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-06-02 09:58:05 +0300 |
commit | dfb56175278409fc56298890b1ca617d0e00992c (patch) | |
tree | 5db7fe8622c329bafaeaf3fa9e1f4ec0067c2869 /qc_app/parse.py | |
parent | 8bb941deef5208bdccd3805af93c982aac627752 (diff) | |
download | gn-uploader-dfb56175278409fc56298890b1ca617d0e00992c.tar.gz |
Add an error display to the progress status report
Enable the progress status page to show all the errors found at any
point during the processing of the file.
Diffstat (limited to 'qc_app/parse.py')
-rw-r--r-- | qc_app/parse.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qc_app/parse.py b/qc_app/parse.py index 578ab70..ec9962b 100644 --- a/qc_app/parse.py +++ b/qc_app/parse.py @@ -20,6 +20,7 @@ from quality_control.parsing import ( strain_names) parsebp = Blueprint("parse", __name__) +isinvalidvalue = lambda item: isinstance(item, InvalidValue) @parsebp.route("/parse", methods=["GET"]) def parse(): @@ -72,19 +73,23 @@ def parse_status(job_id: str): progress = float(job["percent"]) status = job["status"] filename = job.get("filename", "uploaded file") + errors = jsonpickle.decode( + job.get("errors", jsonpickle.encode(tuple()))) if status == "success": return redirect(url_for("parse.results", job_id=job_id)) if status == "parse-error": return redirect(url_for("parse.fail", job_id=job_id)) + app.jinja_env.globals.update(isinvalidvalue=isinvalidvalue) return render_template( "job_progress.html", job_id = job_id, job_status = status, progress = progress, message = job.get("message", ""), - job_name = f"Parsing '{filename}'") + job_name = f"Parsing '{filename}'", + errors=errors) return render_template("no_such_job.html", job_id=job_id) @@ -97,11 +102,11 @@ def results(job_id: str): if job: filename = job["filename"] errors = jsonpickle.decode(job["errors"]) + app.jinja_env.globals.update(isinvalidvalue=isinvalidvalue) return render_template( "parse_results.html", errors=errors, - job_name = f"Parsing '{filename}'", - isinvalidvalue=lambda item: isinstance(item, InvalidValue)) + job_name = f"Parsing '{filename}'") return render_template("no_such_job.html", job_id=job_id) |