diff --git a/WORKLOG.md b/WORKLOG.md index 6ef0a665..b8bc44c9 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -33,25 +33,14 @@ ## NOW *CLIENT* -* fix mobile menu - * make fullscreen - * disappear on touch -* find cause of lag - *SERVER* * std game mode * time control - * animation delay phase end * eth adapter * pay for rerolls -* warden - * set upkeep_at timestamp for games and instances - -* log game results for analysis - ## SOON * push events diff --git a/server/src/game.rs b/server/src/game.rs index 58a8ad04..12000476 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -805,11 +805,10 @@ pub fn game_update(tx: &mut Transaction, game: &Game) -> Result<(), Error> { result.iter().next().ok_or(format_err!("game {:?} could not be written", game))?; if game.finished() { + info!("game finished state={:?}", game); + if let Some(i) = game.instance { - match i == Uuid::nil() { - true => global_game_finished(tx, &game)?, - false => instance_game_finished(tx, &game, i)?, - } + instance_game_finished(tx, &game, i)?; } } diff --git a/server/src/instance.rs b/server/src/instance.rs index be3e2493..8e3b826b 100644 --- a/server/src/instance.rs +++ b/server/src/instance.rs @@ -312,7 +312,8 @@ impl Instance { fn finish_condition(&self) -> bool { match self.format { // bo5 standard - Format::Standard => self.players.iter().any(|p| p.score.wins > 2), + // OR condition is for forfeitures + Format::Standard => self.players.iter().any(|p| p.score.wins > 2) || self.rounds.len() == 5, // everybody plays each other once Format::RoundRobin => self.rounds.len() == self.players.len() - 1, @@ -546,6 +547,10 @@ pub fn instance_update(tx: &mut Transaction, instance: Instance) -> Result