diff options
Diffstat (limited to 'uploader/genotypes')
-rw-r--r-- | uploader/genotypes/views.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/uploader/genotypes/views.py b/uploader/genotypes/views.py index 0433420..5105730 100644 --- a/uploader/genotypes/views.py +++ b/uploader/genotypes/views.py @@ -35,8 +35,15 @@ def index(): with database_connection(app.config["SQL_URI"]) as conn: if not bool(request.args.get("species_id")): return render_template("genotypes/index.html", - species=order_by_family(all_species(conn)), + species=all_species(conn), activelink="genotypes") + + species_id = request.args.get("species_id") + if species_id == "CREATE-SPECIES": + return redirect(url_for( + "species.create_species", + return_to="species.populations.genotypes.select_population")) + species = species_by_id(conn, request.args.get("species_id")) if not bool(species): flash(f"Could not find species with ID '{request.args.get('species_id')}'!", @@ -56,11 +63,17 @@ def select_population(species: dict, species_id: int): if not bool(request.args.get("population_id")): return render_template("genotypes/select-population.html", species=species, - populations=order_by_family( - populations_by_species(conn, species_id), - order_key="FamilyOrder"), + populations=populations_by_species( + conn, species_id), activelink="genotypes") + 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.samples.list_genotypes")) + population = population_by_species_and_id( conn, species_id, request.args.get("population_id")) if not bool(population): |