finish logs
This commit is contained in:
+3
-4
@@ -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)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Insta
|
||||
|
||||
// info!("{:?} wrote instance", instance.id);
|
||||
|
||||
if instance.finished() {
|
||||
info!("instance finished state={:?}", instance);
|
||||
}
|
||||
|
||||
return Ok(instance);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user