From 7fa4094b834020a999401a08d28a689c1bda8639 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 18 Jan 2025 14:24:32 -0500 Subject: [PATCH] Add URLs to poll choices --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ede313d..e2ee1d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -178,7 +178,8 @@ async fn leaderboard_submit_score(State(state): State, Path(slug): Pat #[derive(Debug, Clone, Deserialize)] struct PollChoiceConfig { id: i32, - name: String + name: String, + url: String, } #[derive(Debug, Clone, Deserialize)] @@ -198,6 +199,7 @@ struct PollsConfig { struct PollChoiceResponse { id: i32, name: String, + url: String, votes: i32 } @@ -234,12 +236,14 @@ async fn view_current_poll(State(state): State) -> Response { choices.push(PollChoiceResponse { id: choice.id, name: choice.name.clone(), + url: choice.url.clone(), votes: vote_choice.votes, }); } else { choices.push(PollChoiceResponse { id: choice.id, name: choice.name.clone(), + url: choice.url.clone(), votes: 0, }); }