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 {

View file

@ -4497,7 +4497,11 @@ impl PrepScreen {
.link(trf("Show {other}", &[("other", &other_name)]))
.clicked()
{
self.color = ColorChoice::from_side(if other { Side::White } else { Side::Black });
self.set_color(ColorChoice::from_side(if other {
Side::White
} else {
Side::Black
}));
}
});
}
@ -6061,13 +6065,13 @@ impl PrepScreen {
self.tab = Tab::Errors;
}
if ctx.input_mut(|i| i.consume_shortcut(&alt(Key::Num1))) {
self.color = ColorChoice::White;
self.set_color(ColorChoice::White);
}
if ctx.input_mut(|i| i.consume_shortcut(&alt(Key::Num2))) {
self.color = ColorChoice::Black;
self.set_color(ColorChoice::Black);
}
if ctx.input_mut(|i| i.consume_shortcut(&alt(Key::Num3))) {
self.color = ColorChoice::Both;
self.set_color(ColorChoice::Both);
}
if ctx.input_mut(|i| i.consume_shortcut(&ctrl(Key::W))) {
actions.push(PrepAction::Back);