Add URLs to poll choices

This commit is contained in:
Joshua Goins 2025-01-18 14:24:32 -05:00
parent e256a9db25
commit 7fa4094b83

View file

@ -178,7 +178,8 @@ async fn leaderboard_submit_score(State(state): State<AppState>, 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<AppState>) -> 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,
});
}