Now that the application is going to have multiple pages, vote data makes no sense
to keep with the user.
The user struct will be used everywhere to check for authentication, which is not
the case for previous votes.
Create a new struct and function in src/vote.rs to retrieve existing votes and
use them in places where user.votes was used previously.
Remove vote-related code from src/auth.rs and the week number dependence that it
required.
Now that we have the name of the world, we can show it in the title.
The base I used supposed an english language page, which is incorrect here.
Set language as French.
The index is a full HTML page with some boilerplate that would be needed in all
pages deviating from the truth list, specifically the head and general structure.
Make the core structure a base template, rebuild the week index page inheriting
from it.
Change which template is used by the route accordingly.
Static files served with FileServer have a low priority : all other possible routes
a this root will be checked first, before they get returned.
As we have a lot of routes at the root, they will be hit a lot before we get
to the static files.
Move the static files to a dedicated path to reduce those internal redirections,
update the paths in the HTML and add one for the favicon so it continues to work.
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.
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.
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.
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.
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.
- 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
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.