week: Add week number to the DisplayTruth

In order to have all the relevant information for displaying a truth everywhere, add
its week number.
Fetch it during the week rendering and use it for the link back.
This commit is contained in:
trotFunky 2024-07-29 22:53:36 +01:00
parent 4e1e9facc6
commit 072889173f
3 changed files with 3 additions and 2 deletions

View file

@ -64,7 +64,7 @@ pub async fn week(week_number: u8, mut db: Connection<Db>, cookies: &CookieJar<'
vote_data: vote_data
})
} else {
let truths: Vec<DisplayTruth> = match sqlx::query_as("SELECT id, number, author_id, rendered_text FROM Truths WHERE week == $1 ORDER BY number")
let truths: Vec<DisplayTruth> = match sqlx::query_as("SELECT id, week, number, author_id, rendered_text FROM Truths WHERE week == $1 ORDER BY number")
.bind(week_number)
.fetch_all(&mut **db).await {
Ok(v) => v,