mirror of
https://codeberg.org/icewind/ugc-scaper.git
synced 2026-06-03 18:24:10 +02:00
more forgiving match history
This commit is contained in:
parent
5617493524
commit
bc449f894c
1 changed files with 7 additions and 14 deletions
|
|
@ -148,20 +148,13 @@ impl Parser for TeamMatchesParser {
|
||||||
|
|
||||||
let (score, score_opponent) =
|
let (score, score_opponent) =
|
||||||
scores
|
scores
|
||||||
.split_once(" -\n")
|
.split_once("-")
|
||||||
.ok_or_else(|| ParseError::InvalidText {
|
.ok_or_else(|| ParseError::InvalidText {
|
||||||
text: scores.to_string(),
|
text: scores.to_string(),
|
||||||
role: "match scores",
|
role: "match scores",
|
||||||
})?;
|
})?;
|
||||||
let score = score.parse().map_err(|_| ParseError::InvalidText {
|
let score: u8 = score.trim().parse().unwrap_or_default();
|
||||||
text: scores.to_string(),
|
let score_opponent: u8 = score_opponent.trim().parse().unwrap_or_default();
|
||||||
role: "match scores",
|
|
||||||
});
|
|
||||||
let score_opponent =
|
|
||||||
score_opponent.parse().map_err(|_| ParseError::InvalidText {
|
|
||||||
text: scores.to_string(),
|
|
||||||
role: "match scores",
|
|
||||||
});
|
|
||||||
|
|
||||||
let opponent = opponent_link
|
let opponent = opponent_link
|
||||||
.map(|link| {
|
.map(|link| {
|
||||||
|
|
@ -181,16 +174,16 @@ impl Parser for TeamMatchesParser {
|
||||||
(Some(opponent), Some(point), Some(points_opponent)) => {
|
(Some(opponent), Some(point), Some(points_opponent)) => {
|
||||||
MatchResult::Played {
|
MatchResult::Played {
|
||||||
opponent,
|
opponent,
|
||||||
score: score?,
|
score: score,
|
||||||
score_opponent: score_opponent?,
|
score_opponent: score_opponent,
|
||||||
match_points: point,
|
match_points: point,
|
||||||
match_points_opponent: points_opponent,
|
match_points_opponent: points_opponent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(Some(opponent), None, None) => MatchResult::Pending {
|
(Some(opponent), None, None) => MatchResult::Pending {
|
||||||
opponent,
|
opponent,
|
||||||
score: score?,
|
score: score,
|
||||||
score_opponent: score_opponent?,
|
score_opponent: score_opponent,
|
||||||
},
|
},
|
||||||
_ => MatchResult::ByeWeek,
|
_ => MatchResult::ByeWeek,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue