Add URLs to poll choices
This commit is contained in:
parent
e256a9db25
commit
7fa4094b83
1 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue