Commit graph

9 commits

Author SHA1 Message Date
c4e252dbc2 auth: Add a logout button
Add a logout button that clears the auth cookies, logging out the user.
It also tries to remove the auth token from the databse, but will ignore
any error during the database operation.

Do some include clean-ups as well.
2024-07-26 20:32:16 +01:00
ba98c3be84 index: Remove the form if all votes were cast
Currently, if all votes are cast and the week is locked the selections are disabled but
the form and button still exist and might cause confusion.
Remove them if all votes are cast and we are not on the last week anymore.
2024-07-26 17:57:06 +01:00
a0b79a17ea Redirects: properly redirect to the current week
Previously, most redirects targeted the root of the application.
This was okay for the first part of development where only one week would be
active, but would be annoying when using multiple weeks.

Change those redirects to call week::week.

Change the login path to be dependant on the current week as well,
so it can be correctly redirected.
2024-07-26 01:08:47 +01:00
e08a46af3a week: Create new weeks and change active one
Implement a way for admins to introduce new weeks and set them as the last active one.
The last active week is the last one that is accessible to players, and will also prevent
the graph from being displayed.

Implement arrows for navigating between the weeks in the HTML.
2024-07-26 00:52:41 +01:00
dfdd079ac4 templates/truth: Prevent changing vote if not last week
If the week is not active anymore, prevent changing any vote but allow adding missing ones.
2024-07-25 23:44:00 +01:00
207ce6c1d2 templates: Check vote against truth id, not number
I made a choice to only log confirmed votes : there is no blank vote in the database.
This means that when fetching a user's vote, if they have not voted for everyone
there will be votes missing.
As this is sent to the templating engine via a Vector, the ordering of the votes
will be incorrect : all existing votes will follow each other, and there will be
missing votes at the end.

Update the select logic in the truth template to account for that by checking
the truth_id directly, rather than via the index of the array. (O(N²)...)
Remove 'has_vote' as this is not useful anymore.
2024-07-25 23:30:02 +01:00
f7e1218f21 truths: Change truth creation URL
As we will be able to create a new week, <week>/new to <week>/new_truth to
differentiate it from the week creation URL.
2024-07-25 16:54:19 +01:00
67ce54e992 v1.1: Add weekly introductions
- Create a new migration adding a Weeks table, allowing for new weekly introductions
     and paving the way for multiple week handling.
 - Add route to update the weekly introduction
 - Move the week rendering to a specific week file
 - Update the templates to use the week number from the week data
 - Update templates to render and edit weekly introductions
2024-07-23 21:51:51 +01:00
9911895b5b v1.0: First production version
This first version allows login of pre-existing users, creation and update of truths
by admins, vote on the truths by users, their display as well as a simple graph
for the vote results.
Everything persisting in a SQLite database.
2024-07-23 21:51:42 +01:00