mirror of
https://codeberg.org/icewind/log-normalizer.git
synced 2026-06-03 22:04:05 +02:00
less panicy
This commit is contained in:
parent
1b256ecfd9
commit
1df2cd0357
2 changed files with 8 additions and 6 deletions
|
|
@ -92,7 +92,7 @@ impl From<RawLog> for NormalizedLog {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|raw| Round::from(raw))
|
.map(|raw| Round::from(raw))
|
||||||
.collect();
|
.collect();
|
||||||
let teams = raw.teams.or(raw.info.teams).unwrap();
|
let teams = raw.teams.or(raw.info.teams).unwrap_or_default();
|
||||||
|
|
||||||
let mut normalized = NormalizedLog {
|
let mut normalized = NormalizedLog {
|
||||||
version: raw.version,
|
version: raw.version,
|
||||||
|
|
@ -127,8 +127,8 @@ impl From<crate::raw::Round> for Round {
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap_or(TeamId::Blue);
|
||||||
let team = raw.team.or(raw.flat_team).unwrap();
|
let team = raw.team.or(raw.flat_team).unwrap_or_default();
|
||||||
|
|
||||||
Round {
|
Round {
|
||||||
start_time: raw.start_time,
|
start_time: raw.start_time,
|
||||||
|
|
@ -191,7 +191,9 @@ fn normalize_stopwatch_events(log: &mut NormalizedLog) {
|
||||||
team: TeamId::Blue,
|
team: TeamId::Blue,
|
||||||
point: first_half_rounds,
|
point: first_half_rounds,
|
||||||
});
|
});
|
||||||
log.rounds[1].events.push(last_event.unwrap());
|
if let Some(last_event) = last_event {
|
||||||
|
log.rounds[1].events.push(last_event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,14 @@ pub struct RawLog {
|
||||||
pub info: Info,
|
pub info: Info,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize, Default)]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
pub struct Teams {
|
pub struct Teams {
|
||||||
pub red: Team,
|
pub red: Team,
|
||||||
pub blue: Team,
|
pub blue: Team,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize, Default)]
|
||||||
pub struct Team {
|
pub struct Team {
|
||||||
pub score: u8,
|
pub score: u8,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue