Opponent prep: the newest game by its earliest day; dates after today are typos

One game of «2026.??.??» no longer moves a period past the exactly dated
games; a date after today counts as none (in periods and in «Last N»).
Every colour change goes through set_color; a name with two ids in the
database takes both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-31 21:58:10 +03:00
parent 758856f458
commit e2f4935ecc
3 changed files with 41 additions and 20 deletions

View file

@ -948,10 +948,12 @@ impl App {
let mut ids = Vec::new();
let mut missing = None;
for name in &names {
// Every id of the name (a ChessBase database can have two).
let (found, _) = prep::candidates(&db, name, 50);
match found.iter().find(|c| c.name == *name) {
Some(c) => ids.push(c.id),
None => missing = Some(name.clone()),
let before = ids.len();
ids.extend(found.iter().filter(|c| c.name == *name).map(|c| c.id));
if ids.len() == before {
missing = Some(name.clone());
}
}
match missing {