From 3c960f6cf885934e5f390390c9e0fae0d6b93d5d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 18 Feb 2025 11:10:29 -0600 Subject: Enable creating new populations on the "Phenotype Data" path. Enable creating new populations in the case where the population a user wants to use does not exist in the database. --- uploader/phenotypes/views.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'uploader/phenotypes') diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index c0ab493..bcbb3a9 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -89,14 +89,18 @@ def select_population(species: dict, **kwargs):# pylint: disable=[unused-argumen if not bool(request.args.get("population_id")): return render_template("phenotypes/select-population.html", species=species, - populations=order_by_family( - populations_by_species( - conn, species["SpeciesId"]), - order_key="FamilyOrder"), + populations=populations_by_species( + conn, species["SpeciesId"]), activelink="phenotypes") + population_id = request.args["population_id"] + if population_id == "CREATE-POPULATION": + return redirect(url_for( + "species.populations.create_population", + species_id=species["SpeciesId"], + return_to="species.populations.phenotypes.list_datasets")) population = population_by_species_and_id( - conn, species["SpeciesId"], int(request.args["population_id"])) + conn, species["SpeciesId"], int(population_id)) if not bool(population): flash("No such population found!", "alert-danger") return redirect(url_for( -- cgit v1.2.3