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)] #[derive(Debug, Clone, Deserialize)]
struct PollChoiceConfig { struct PollChoiceConfig {
id: i32, id: i32,
name: String name: String,
url: String,
} }
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
@ -198,6 +199,7 @@ struct PollsConfig {
struct PollChoiceResponse { struct PollChoiceResponse {
id: i32, id: i32,
name: String, name: String,
url: String,
votes: i32 votes: i32
} }
@ -234,12 +236,14 @@ async fn view_current_poll(State(state): State<AppState>) -> Response {
choices.push(PollChoiceResponse { choices.push(PollChoiceResponse {
id: choice.id, id: choice.id,
name: choice.name.clone(), name: choice.name.clone(),
url: choice.url.clone(),
votes: vote_choice.votes, votes: vote_choice.votes,
}); });
} else { } else {
choices.push(PollChoiceResponse { choices.push(PollChoiceResponse {
id: choice.id, id: choice.id,
name: choice.name.clone(), name: choice.name.clone(),
url: choice.url.clone(),
votes: 0, votes: 0,
}); });
} }