Skip to content

Commit

Permalink
School species list, handling challenges without additional taxa
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkohei13 committed Aug 9, 2024
1 parent d279ae2 commit a52585e
Show file tree
Hide file tree
Showing 9 changed files with 2,580 additions and 769 deletions.
2 changes: 1 addition & 1 deletion app/controllers/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ def main(challenge_id_untrusted):
participations = common_helpers.get_all_participations(challenge_id)
html["participant_html"] = make_participant_html(participations)

html["taxa_html"] = common_helpers.make_taxa_html(participations, challenge_data["taxon"])
html["taxa_html"] = common_helpers.make_taxa_html(participations, challenge_data)

return html
10 changes: 8 additions & 2 deletions app/controllers/participation.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ def make_taxa_html(challenge, taxa_dates_json = None):
}
"""

# Load all taxa names of the higher taxon (e.g. plants)
all_taxa_names = common_helpers.load_taxon_file(taxon_file_id + "_all")
# Ordinary challenger: all taxa file
if challenge["type"] == "challenge100":
all_taxa_names = common_helpers.load_taxon_file(taxon_file_id + "_all")
# School challenge: only basic taxa file
elif challenge["type"] == "school100":
all_taxa_names = common_helpers.load_taxon_file(taxon_file_id)
else:
raise Exception("Unknown challenge type.")

basic_taxa_html = ""

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/participation_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main(challenge_id_untrusted, participation_id_untrusted):
# Not participation of this user
return {"redirect": True, "url": "/"}

html["taxa_html"] = common_helpers.make_taxa_html(participations, challenge_data["taxon"], participation_data["taxa_json"])
html["taxa_html"] = common_helpers.make_taxa_html(participations, challenge_data, participation_data["taxa_json"])

html["challenge_data"] = challenge_data
html["participation_data"] = participation_data
Expand Down
Loading

0 comments on commit a52585e

Please sign in to comment.