Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/w-henderson/Kascreech int…
Browse files Browse the repository at this point in the history
…o master
  • Loading branch information
w-henderson committed Dec 11, 2020
2 parents 4c504d8 + 6956d50 commit d7eefe5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/src/quiz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Chungus {
pub fn game_start_time(&self) -> &u128 {
&self.game_start_time
}
fn answers(&self) -> Vec<Vec<usize>> {
self.questions.iter().map(|a| a.correct.clone()).collect()
fn answers(&self) -> Vec<&Vec<usize>> {
self.questions.iter().map(|a| &a.correct).collect()
}
}
8 changes: 4 additions & 4 deletions server/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub struct Guess {
}

#[derive(Serialize)]
pub struct SetupGame {
answers: Vec<Vec<usize>>,
pub struct SetupGame<'a> {
answers: Vec<&'a Vec<usize>>,
#[serde(rename = "timePerQuestion")]
time_per_question: u128, // this is milliseconds
#[serde(rename = "timeShowingAnswers")]
Expand All @@ -21,9 +21,9 @@ pub struct SetupGame {
game_start_time: u128, // timestamp in milliseconds of when the game starts so they're all 100% in sync, should be at least 30 seconds after request is made
}

impl SetupGame {
impl<'a> SetupGame<'a> {
pub fn new(
answers: Vec<Vec<usize>>,
answers: Vec<&'a Vec<usize>>,
time_per_question: Option<u128>,
time_showing_answers: Option<u128>,
time_showing_leaderboard: Option<u128>,
Expand Down

0 comments on commit d7eefe5

Please sign in to comment.