aboutsummaryrefslogtreecommitdiff
path: root/qc_app/upload
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-07 16:18:23 +0300
committerFrederick Muriuki Muriithi2024-02-07 16:18:37 +0300
commit60bfd62058f3250e99cf8467e407ce756cdc333a (patch)
treea0e9c7779c58b1af2a2fc4b45a17f5018ad83bac /qc_app/upload
parent5b63c582c106ac219d16a79a995b0bc2fde6fcf5 (diff)
downloadgn-uploader-60bfd62058f3250e99cf8467e407ce756cdc333a.tar.gz
Fix error display: setup correct error class
Diffstat (limited to 'qc_app/upload')
-rw-r--r--qc_app/upload/rqtl2.py62
1 files changed, 30 insertions, 32 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py
index 810e031..f36a3a6 100644
--- a/qc_app/upload/rqtl2.py
+++ b/qc_app/upload/rqtl2.py
@@ -60,7 +60,7 @@ def select_species():
if bool(species):
return redirect(url_for(
"upload.rqtl2.select_population", species_id=species_id))
- flash("Invalid species or no species selected!", "alert-error alert-rqtl2")
+ flash("Invalid species or no species selected!", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_species"))
@rqtl2.route("/upload/species/<int:species_id>/select-population",
@@ -70,7 +70,7 @@ def select_population(species_id: int):
with database_connection(app.config["SQL_URI"]) as conn:
species = species_by_id(conn, species_id)
if not bool(species):
- flash("Invalid species selected!", "alert-error alert-rqtl2")
+ flash("Invalid species selected!", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_species"))
if request.method == "GET":
@@ -82,7 +82,7 @@ def select_population(species_id: int):
population = population_by_species_and_id(
conn, species["SpeciesId"], request.form.get("inbredset_id"))
if not bool(population):
- flash("Invalid Population!", "alert-error alert-rqtl2")
+ flash("Invalid Population!", "alert-error error-rqtl2")
return redirect(
url_for("upload.rqtl2.select_population", pgsrc="error"),
code=307)
@@ -102,13 +102,13 @@ def create_population(species_id: int):
population_name = request.form.get("inbredset_name", "").strip()
population_fullname = request.form.get("inbredset_fullname", "").strip()
if not bool(species):
- flash("Invalid species!", "alert-error alert-rqtl2")
+ flash("Invalid species!", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_species"))
if not bool(population_name):
- flash("Invalid Population Name!", "alert-error alert-rqtl2")
+ flash("Invalid Population Name!", "alert-error error-rqtl2")
return population_page
if not bool(population_fullname):
- flash("Invalid Population Full Name!", "alert-error alert-rqtl2")
+ flash("Invalid Population Full Name!", "alert-error error-rqtl2")
return population_page
new_population = save_population(conn, {
"SpeciesId": species["SpeciesId"],
@@ -146,10 +146,10 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
population = population_by_species_and_id(
conn, species["SpeciesId"], population_id)
if not bool(species):
- flash("Invalid species!", "alert-error alert-rqtl2")
+ flash("Invalid species!", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_species"))
if not bool(population):
- flash("Invalid Population!", "alert-error alert-rqtl2")
+ flash("Invalid Population!", "alert-error error-rqtl2")
return redirect(
url_for("upload.rqtl2.select_population", pgsrc="error"),
code=307)
@@ -180,7 +180,7 @@ def upload_rqtl2_bundle(species_id: int, population_id: int):
population=population,
rqtl2_bundle_file=the_file.name)#type: ignore[union-attr]
except (InvalidFormat, __RequestError__) as exc:
- flash("".join(exc.args), "alert-error alert-rqtl2")
+ flash("".join(exc.args), "alert-error error-rqtl2")
return this_page_with_errors
def check_errors(conn, *args, **kwargs):#pylint: disable=[too-many-return-statements]
@@ -192,18 +192,18 @@ def check_errors(conn, *args, **kwargs):#pylint: disable=[too-many-return-statem
population = population_by_species_and_id(conn, species_id, population_id)
if "species" in args and not bool(species):
- flash("Invalid species!", "alert-error alert-rqtl2")
+ flash("Invalid species!", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_species"))
if "population" in args and not bool(population):
- flash("Invalid Population!", "alert-error alert-rqtl2")
+ flash("Invalid Population!", "alert-error error-rqtl2")
return redirect(
url_for("upload.rqtl2.select_population", pgsrc="error"),
code=307)
if ("rqtl2_bundle_file" in args
and not bool(request.form.get("rqtl2_bundle_file"))):
- flash("There is no file to process.", "alert-error alert-rqtl2")
+ flash("There is no file to process.", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.upload_rqtl2_bundle",
species_id=species_id,
population_id=population_id,
@@ -212,7 +212,7 @@ def check_errors(conn, *args, **kwargs):#pylint: disable=[too-many-return-statem
if ("geno-dataset" in args and
not bool(request.form.get("geno-dataset-id"))):
- flash("No genotype dataset was provided!", "alert-error alert-rqtl2")
+ flash("No genotype dataset was provided!", "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_geno_dataset",
species_id=species_id,
population_id=population_id,
@@ -227,12 +227,12 @@ def check_errors(conn, *args, **kwargs):#pylint: disable=[too-many-return-statem
if ("probe-study-id" in args and
not bool(request.form.get("probe-study-id"))):
- flash("No probeset study was selected!", "alert-error alert-rqtl2")
+ flash("No probeset study was selected!", "alert-error error-rqtl2")
return summary_page
if ("probe-dataset-id" in args and
not bool(request.form.get("probe-dataset-id"))):
- flash("No probeset dataset was selected!", "alert-error alert-rqtl2")
+ flash("No probeset dataset was selected!", "alert-error error-rqtl2")
return summary_page
return None
@@ -252,14 +252,14 @@ def select_geno_dataset(species_id: int, population_id: int):
conn, species_id, population_id)
if not bool(geno_dset):
flash("No genotype dataset was provided!",
- "alert-error alert-rqtl2")
+ "alert-error error-rqtl2")
return redirect(url_for("upload.rqtl2.select_geno_dataset",
species_id=species_id,
population_id=population_id,
pgsrc="error"),
code=307)
- flash("Genotype accepted", "alert-success alert-rqtl2")
+ flash("Genotype accepted", "alert-success error-rqtl2")
return redirect(url_for("upload.rqtl2.select_dataset_info",
species_id=species_id,
population_id=population_id,
@@ -281,17 +281,15 @@ def create_geno_dataset(species_id: int, population_id: int):
population_id=population_id,
pgsrc="error"),
code=307)
+ errorclasses = "alert-error error-rqtl2 error-rqtl2-create-geno-dataset"
if not bool(request.form.get("dataset-name")):
- flash("You must provide the dataset name",
- "alert-error alert-rqtl2")
+ flash("You must provide the dataset name", errorclasses)
return sgeno_page
if not bool(request.form.get("dataset-fullname")):
- flash("You must provide the dataset full name",
- "alert-error alert-rqtl2")
+ flash("You must provide the dataset full name", errorclasses)
return sgeno_page
if not bool(request.form.get("dataset-shortname")):
- flash("You must provide the dataset short name",
- "alert-error alert-rqtl2")
+ flash("You must provide the dataset short name", errorclasses)
return sgeno_page
public = 2 if request.form.get("dataset-public") == "on" else 0
@@ -338,7 +336,7 @@ def select_probeset_study(species_id: int, population_id: int):
population_id=population_id),
code=307)
if not bool(probeset_study_by_id(conn, int(request.form["probe-study-id"]))):
- flash("Invalid study selected!", "alert-error alert-rqtl2")
+ flash("Invalid study selected!", "alert-error error-rqtl2")
return summary_page
return summary_page
@@ -360,7 +358,7 @@ def select_probeset_dataset(species_id: int, population_id: int):
population_id=population_id),
code=307)
if not bool(probeset_study_by_id(conn, int(request.form["probe-study-id"]))):
- flash("Invalid study selected!", "alert-error alert-rqtl2")
+ flash("Invalid study selected!", "alert-error error-rqtl2")
return summary_page
return summary_page
@@ -385,12 +383,12 @@ def create_probeset_study(species_id: int, population_id: int):
if not (bool(form.get("platformid")) and
bool(platform_by_id(conn, int(form["platformid"])))):
- flash("Invalid platform selected.", "alert-error alert-rqtl2")
+ flash("Invalid platform selected.", "alert-error error-rqtl2")
return select_study_page
if not (bool(form.get("tissueid")) and
bool(tissue_by_id(conn, int(form["tissueid"])))):
- flash("Invalid tissue selected.", "alert-error alert-rqtl2")
+ flash("Invalid tissue selected.", "alert-error error-rqtl2")
return select_study_page
study = probeset_create_study(
@@ -426,23 +424,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 alert-rqtl2")
+ flash("Averaging method not selected!", "alert-error error-rqtl2")
return summary_page
if not bool(form.get("datasetname")):
- flash("Dataset name not provided!", "alert-error alert-rqtl2")
+ flash("Dataset name not provided!", "alert-error error-rqtl2")
return summary_page
if not bool(form.get("datasetfullname")):
- flash("Dataset full name not provided!", "alert-error alert-rqtl2")
+ flash("Dataset full name not provided!", "alert-error error-rqtl2")
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 alert-rqtl2")
+ flash("Invalid ProbeSet study provided!", "alert-error error-rqtl2")
return summary_page
avgmethod = averaging_method_by_id(conn, int(form["averageid"]))
if not bool(avgmethod):
- flash("Invalid averaging method provided!", "alert-error alert-rqtl2")
+ flash("Invalid averaging method provided!", "alert-error error-rqtl2")
return summary_page
dset = probeset_create_dataset(conn,