Skip to content

Commit

Permalink
Add tests for admin ui
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkohei13 committed Aug 23, 2024
1 parent 3101ebe commit 36a86d4
Show file tree
Hide file tree
Showing 7 changed files with 2,663 additions and 16 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ Note that in order to create MariaDB database on Rahti, PHPMyAdmin data dump doe

## Todo

### Changes for v 2.0

- Update code to staging
- Add new fields to database:
ALTER TABLE `challenges` ADD `date_begin` VARCHAR(10) NULL AFTER `year`, ADD `date_end` VARCHAR(10) NULL AFTER `date_begin`;
- Remove old fields from database:
ALTER TABLE `challenges` DROP `year`;
- Add begin and end date to all challenges

### Next

* Fix autocomplete-added species min/max dates being 2022-??
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ def make_challenges_html(challenges):
for challenge in challenges:
participations_html = ""

challenge_id = f"challenge_{ challenge['challenge_id'] }"

if challenge["status"] == "open" or challenge["status"] == "closed":
participations_html = "Ei osallistujia" # default value
participations = get_participations(challenge["challenge_id"])
if len(participations) > 0:
participations_html = make_participations_stats_html(participations)

html += "<div class='challenge'>\n"
html += f"<div class='challenge' id='{ challenge_id }'>\n"
html += f"<h3>{ challenge['title'] }</a></h3>\n"
html += participations_html
html += "<p>"
Expand Down
Loading

0 comments on commit 36a86d4

Please sign in to comment.