vote: Change graph display condition, don't fetch for admin
Now, the graph will only show when everyone has voted and the week is no longer the last one active. This is to minimize information gathering by looking during voting. Don't fetch the vote data for the admin : it is not used, so no need to query the database. Update README with new TODOs and clean up main includes a bit.
This commit is contained in:
parent
f41f5142c9
commit
635716c04b
4 changed files with 15 additions and 5 deletions
|
@ -86,7 +86,8 @@ pub async fn get_user(week: u8, db: &mut Connection<Db>, cookies: &CookieJar<'_>
|
|||
(String::new(), false)
|
||||
};
|
||||
|
||||
let votes: Vec<Vote> = if logged_in {
|
||||
// TODO: Move to src/vote.rs
|
||||
let votes: Vec<Vote> = if logged_in && !is_admin {
|
||||
sqlx::query_as("SELECT Votes.* FROM Votes JOIN Truths ON Votes.truth_id == Truths.id AND Truths.week == $1 WHERE voter_id == $2 ORDER BY Truths.number;")
|
||||
.bind(week)
|
||||
.bind(&id_str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue