finish logs

This commit is contained in:
ntr 2019-06-01 14:01:48 +10:00
parent 574f260a30
commit c921e790c9
3 changed files with 9 additions and 16 deletions

View File

@ -33,25 +33,14 @@
## NOW ## NOW
*CLIENT* *CLIENT*
* fix mobile menu
* make fullscreen
* disappear on touch
* find cause of lag
*SERVER* *SERVER*
* std game mode * std game mode
* time control * time control
* animation delay phase end
* eth adapter * eth adapter
* pay for rerolls * pay for rerolls
* warden
* set upkeep_at timestamp for games and instances
* log game results for analysis
## SOON ## SOON
* push events * push events

View File

@ -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))?; result.iter().next().ok_or(format_err!("game {:?} could not be written", game))?;
if game.finished() { if game.finished() {
info!("game finished state={:?}", game);
if let Some(i) = game.instance { if let Some(i) = game.instance {
match i == Uuid::nil() { instance_game_finished(tx, &game, i)?;
true => global_game_finished(tx, &game)?,
false => instance_game_finished(tx, &game, i)?,
}
} }
} }

View File

@ -312,7 +312,8 @@ impl Instance {
fn finish_condition(&self) -> bool { fn finish_condition(&self) -> bool {
match self.format { match self.format {
// bo5 standard // 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 // everybody plays each other once
Format::RoundRobin => self.rounds.len() == self.players.len() - 1, Format::RoundRobin => self.rounds.len() == self.players.len() - 1,
@ -546,6 +547,10 @@ pub fn instance_update(tx: &mut Transaction, instance: Instance) -> Result<Insta
// info!("{:?} wrote instance", instance.id); // info!("{:?} wrote instance", instance.id);
if instance.finished() {
info!("instance finished state={:?}", instance);
}
return Ok(instance); return Ok(instance);
} }