From 186df2bacd11beae53a0c4562e9dcc72c6d253c8 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 8 Apr 2024 09:36:38 +0300 Subject: bug: UI: Provide better error messaging. --- qc_app/upload/rqtl2.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'qc_app/upload') diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index e0fb40c..876f17c 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -651,6 +651,7 @@ def create_probeset_study(species_id: int, population_id: int): methods=["POST"]) def create_probeset_dataset(species_id: int, population_id: int):#pylint: disable=[too-many-return-statements] """Create a new probeset dataset.""" + errorclasses = "alert-error error-rqtl2 error-rqtl2-create-probeset-dataset" with database_connection(app.config["SQL_URI"]) as conn: def __thunk__(): form = request.form @@ -659,23 +660,23 @@ def create_probeset_dataset(species_id: int, population_id: int):#pylint: disabl population_id=population_id), code=307) if not bool(form.get("averageid")): - flash("Averaging method not selected!", "alert-error error-rqtl2") + flash("Averaging method not selected!", errorclasses) return summary_page if not bool(form.get("datasetname")): - flash("Dataset name not provided!", "alert-error error-rqtl2") + flash("Dataset name not provided!", errorclasses) return summary_page if not bool(form.get("datasetfullname")): - flash("Dataset full name not provided!", "alert-error error-rqtl2") + flash("Dataset full name not provided!", errorclasses) return summary_page study = probeset_study_by_id(conn, int(form["probe-study-id"])) if not bool(study): - flash("Invalid ProbeSet study provided!", "alert-error error-rqtl2") + flash("Invalid ProbeSet study provided!", errorclasses) return summary_page avgmethod = averaging_method_by_id(conn, int(form["averageid"])) if not bool(avgmethod): - flash("Invalid averaging method provided!", "alert-error error-rqtl2") + flash("Invalid averaging method provided!", errorclasses) return summary_page try: @@ -691,14 +692,14 @@ def create_probeset_dataset(species_id: int, population_id: int):#pylint: disabl except mdb.IntegrityError as _ierr: flash(("A dataset with that name already exists. Try selecting " "from list of datasets instead."), - "alert-error error-rqtl2") + errorclasses) return summary_page except Exception as _exc: app.logger.debug("Error creating ProbeSet dataset: %s", traceback.format_exc()) flash(("There was a problem creating your dataset. Please try " "again."), - "alert-error error-rqtl2") + errorclasses) return render_template( "rqtl2/create-probe-dataset-success.html", species=species_by_id(conn, species_id), -- cgit v1.2.3