Release 2.1.5
Some checks failed
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Some checks failed
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Automatically save opponent preparations and start the opening-error engine when the report is ready, while preserving manual Stop and saved evaluations. Remove the book comparison from opponent preparation: its UI, background work, algorithm and development hook are gone. Legacy saved data remains readable and is preserved for a possible future revert. Align game counts, error counts and percentages in the preparation summary and refresh the architecture and team documentation.
This commit is contained in:
parent
101e976c48
commit
fdcb12bd80
30 changed files with 1118 additions and 1342 deletions
|
|
@ -376,7 +376,7 @@ struct DebugStartup {
|
|||
/// `CP_TYPE=<text>`: typed into the field that has the keyboard, 2.5 s after start.
|
||||
typed: Option<String>,
|
||||
/// `CP_PREP=<name>`: «Prepare against…» for this name in the first database
|
||||
/// (`CP_PREP_OPEN=1` presses «Open report», `CP_PREP_TAB`, `CP_PREP_ENGINE=1`).
|
||||
/// (`CP_PREP_OPEN=1` presses «Open report», `CP_PREP_TAB`).
|
||||
prep: Option<String>,
|
||||
}
|
||||
|
||||
|
|
@ -892,8 +892,8 @@ impl App {
|
|||
if let Some(p) = self.prep.as_mut()
|
||||
&& p.matches(&start.path, &start.player)
|
||||
{
|
||||
// The report as it was, with the colour and the book of the dialog.
|
||||
p.reopen(start.side, start.book);
|
||||
// The report as it was, with the colour of the dialog.
|
||||
p.reopen(start.side);
|
||||
return;
|
||||
}
|
||||
if let Some(mut old) = self.prep.take() {
|
||||
|
|
@ -1008,13 +1008,7 @@ impl App {
|
|||
self.settings.touch_database(&meta.path);
|
||||
self.settings_dirty = true;
|
||||
}
|
||||
let dbs = self.shelf_dbs();
|
||||
let start = crate::prep_ui::PrepStart {
|
||||
book: crate::prep_ui::BookChoice::from_setting(
|
||||
Some(&meta.book),
|
||||
&meta.path,
|
||||
&dbs,
|
||||
),
|
||||
path: meta.path,
|
||||
player: meta.player,
|
||||
side: meta.color,
|
||||
|
|
@ -1076,11 +1070,6 @@ impl App {
|
|||
g.goto_ply(ply);
|
||||
}
|
||||
}
|
||||
PrepAction::LoadDb(p) => {
|
||||
if !self.library.loading(&p) && self.library.database(&p).is_none() {
|
||||
self.library.load(&p, ctx);
|
||||
}
|
||||
}
|
||||
// One engine job for the whole program: the live engine is off while
|
||||
// the report is on the screen anyway (no game is open then).
|
||||
PrepAction::EngineStarted => {
|
||||
|
|
@ -3918,13 +3907,9 @@ impl eframe::App for App {
|
|||
}
|
||||
}
|
||||
} else if self.prep.as_ref().is_some_and(|p| p.shown) {
|
||||
// A database opened for the book arrives here (the library is not drawn).
|
||||
self.library.poll();
|
||||
let actions = match self.prep.as_mut() {
|
||||
Some(p) => {
|
||||
p.dbs = shelf;
|
||||
p.show(ui, &mut self.settings)
|
||||
}
|
||||
Some(p) => p.show(ui, &mut self.settings),
|
||||
None => Vec::new(),
|
||||
};
|
||||
self.prep_actions(&ctx, actions);
|
||||
|
|
|
|||
|
|
@ -14209,17 +14209,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
[
|
||||
"None", "Нет", "Aucun", "Keines", "Ninguno", "Nessuno", "Nenhum", "Yo‘q", "Жоқ",
|
||||
],
|
||||
[
|
||||
"A book is a large database that shows up to which move his line is common and where he plays a rare move. A rare move is not a mistake.",
|
||||
"Книга — большая база, по которой видно, до какого хода его линия обычна и где он играет редкий ход. Редкий ход — не ошибка.",
|
||||
"Le livre est une grande base qui montre jusqu'à quel coup sa ligne est courante et où il joue un coup rare. Un coup rare n'est pas une erreur.",
|
||||
"Das Buch ist eine große Datenbank, die zeigt, bis zu welchem Zug seine Linie üblich ist und wo er einen seltenen Zug spielt. Ein seltener Zug ist kein Fehler.",
|
||||
"El libro es una base grande que muestra hasta qué jugada su línea es habitual y dónde juega una jugada rara. Una jugada rara no es un error.",
|
||||
"Il libro è un grande database che mostra fino a quale mossa la sua linea è comune e dove gioca una mossa rara. Una mossa rara non è un errore.",
|
||||
"O livro é uma base grande que mostra até que lance a linha dele é comum e onde ele joga um lance raro. Um lance raro não é um erro.",
|
||||
"Kitob — katta baza: undan uning chizig‘i qaysi yurishgacha odatiy ekani va qayerda kam uchraydigan yurish qilishi ko‘rinadi. Kam uchraydigan yurish xato emas.",
|
||||
"Кітап — үлкен база: одан оның желісі қай жүріске дейін әдеттегі екені және қай жерде сирек жүріс жасайтыны көрінеді. Сирек жүріс қате емес.",
|
||||
],
|
||||
[
|
||||
"Preparing against an opponent",
|
||||
"Подготовка к сопернику",
|
||||
|
|
@ -14256,17 +14245,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Kitob",
|
||||
"Кітап",
|
||||
],
|
||||
[
|
||||
"The book shows where he leaves the theory. «None» — without that column.",
|
||||
"По книге видно, где он уходит из теории. «Нет» — без этой колонки.",
|
||||
"Le livre montre où il quitte la théorie. « Aucun » — sans cette colonne.",
|
||||
"Das Buch zeigt, wo er die Theorie verlässt. „Keines“ — ohne diese Spalte.",
|
||||
"El libro muestra dónde deja la teoría. «Ninguno» — sin esa columna.",
|
||||
"Il libro mostra dove lascia la teoria. «Nessuno» — senza quella colonna.",
|
||||
"O livro mostra onde ele deixa a teoria. «Nenhum» — sem essa coluna.",
|
||||
"Kitobdan uning nazariyadan qayerda chiqishi ko‘rinadi. «Yo‘q» — bu ustunsiz.",
|
||||
"Кітаптан оның теориядан қай жерде шығатыны көрінеді. «Жоқ» — бұл бағансыз.",
|
||||
],
|
||||
[
|
||||
"Open report",
|
||||
"Открыть отчёт",
|
||||
|
|
@ -14344,17 +14322,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Partiyalarni o‘qib bo‘lmadi",
|
||||
"Партияларды оқу мүмкін болмады",
|
||||
],
|
||||
[
|
||||
"the position search failed (not enough memory?)",
|
||||
"поиск позиций не удался (не хватает памяти?)",
|
||||
"la recherche de positions a échoué (mémoire insuffisante ?)",
|
||||
"die Stellungssuche ist fehlgeschlagen (zu wenig Speicher?)",
|
||||
"la búsqueda de posiciones falló (¿falta memoria?)",
|
||||
"la ricerca delle posizioni è fallita (memoria insufficiente?)",
|
||||
"a busca de posições falhou (memória insuficiente?)",
|
||||
"pozitsiya qidiruvi bajarilmadi (xotira yetmayaptimi?)",
|
||||
"позиция іздеу сәтсіз аяқталды (жад жетпей ме?)",
|
||||
],
|
||||
[
|
||||
"Opening errors",
|
||||
"Ошибки в дебютах",
|
||||
|
|
@ -14477,15 +14444,15 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Қарамен",
|
||||
],
|
||||
[
|
||||
"book…",
|
||||
"книга…",
|
||||
"livre…",
|
||||
"Buch…",
|
||||
"libro…",
|
||||
"libro…",
|
||||
"livro…",
|
||||
"kitob…",
|
||||
"кітап…",
|
||||
"No engine yet. Stockfish finds the opening errors in his games; add it to start the search.",
|
||||
"Движка пока нет. Stockfish ищет ошибки в его дебютах; добавьте его, чтобы начать поиск.",
|
||||
"Pas encore de moteur. Stockfish trouve les erreurs d’ouverture de ses parties ; ajoutez-le pour lancer la recherche.",
|
||||
"Noch keine Engine. Stockfish findet die Eröffnungsfehler in seinen Partien; fügen Sie sie hinzu, um die Suche zu starten.",
|
||||
"Aún no hay motor. Stockfish encuentra los errores de apertura de sus partidas; añádelo para empezar la búsqueda.",
|
||||
"Ancora nessun motore. Stockfish trova gli errori di apertura delle sue partite; aggiungilo per iniziare la ricerca.",
|
||||
"Ainda não há motor. O Stockfish encontra os erros de abertura das suas partidas; adicione-o para começar a procura.",
|
||||
"Hali dvijok yo‘q. Stockfish uning partiyalaridagi debyut xatolarini topadi; qidiruvni boshlash uchun uni qo‘shing.",
|
||||
"Әзірге движок жоқ. Stockfish оның партияларындағы дебют қателерін табады; іздеуді бастау үшін оны қосыңыз.",
|
||||
],
|
||||
[
|
||||
"Choose a move in the tree, an opening or an error: its position is shown here",
|
||||
|
|
@ -14586,17 +14553,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Partiyasi kamroq yurishlar «boshqa yurishlar»ga yig‘iladi",
|
||||
"Партиясы азырақ жүрістер «басқа жүрістерге» жиналады",
|
||||
],
|
||||
[
|
||||
"In database",
|
||||
"В базе",
|
||||
"Dans la base",
|
||||
"In der Datenbank",
|
||||
"En la base",
|
||||
"Nel database",
|
||||
"Na base",
|
||||
"Bazada",
|
||||
"Базада",
|
||||
],
|
||||
[
|
||||
"His moves plain, the opponents' weak; ⇄ — the position is reached by another move order too",
|
||||
"Его ходы — обычным, ходы соперников — слабым; ⇄ — к позиции приходят и другим порядком ходов",
|
||||
|
|
@ -14652,17 +14608,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Oxirgi",
|
||||
"Соңғы",
|
||||
],
|
||||
[
|
||||
"Games of the book in this position; the first number under the threshold is where he leaves the book",
|
||||
"Партий книги в этой позиции; первое число ниже порога — здесь он выходит из книги",
|
||||
"Parties du livre dans cette position ; le premier nombre sous le seuil marque sa sortie du livre",
|
||||
"Partien des Buches in dieser Stellung; die erste Zahl unter der Schwelle: hier verlässt er das Buch",
|
||||
"Partidas del libro en esta posición; el primer número bajo el umbral es donde deja el libro",
|
||||
"Partite del libro in questa posizione; il primo numero sotto la soglia è dove lascia il libro",
|
||||
"Partidas do livro nesta posição; o primeiro número abaixo do limite é onde ele deixa o livro",
|
||||
"Bu pozitsiyadagi kitob partiyalari; chegaradan past birinchi son — u kitobdan shu yerda chiqadi",
|
||||
"Осы позициядағы кітап партиялары; шектен төмен бірінші сан — ол кітаптан осы жерде шығады",
|
||||
],
|
||||
[
|
||||
"Few games: percentages are unreliable",
|
||||
"Мало партий — проценты ненадёжны",
|
||||
|
|
@ -14806,17 +14751,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Bu partiya debyutidagi uning belgilangan yurishlari",
|
||||
"Осы партия дебютіндегі оның белгіленген жүрістері",
|
||||
],
|
||||
[
|
||||
"This database ({name})",
|
||||
"Эта же база ({name})",
|
||||
"Cette base ({name})",
|
||||
"Diese Datenbank ({name})",
|
||||
"Esta misma base ({name})",
|
||||
"Questo database ({name})",
|
||||
"Esta mesma base ({name})",
|
||||
"Shu baza ({name})",
|
||||
"Осы база ({name})",
|
||||
],
|
||||
[
|
||||
"Selected: {names} · {n}",
|
||||
"Отмечено: {names} · {n}",
|
||||
|
|
@ -14905,17 +14839,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"hisobga olinmadi: berilgan pozitsiyadan — {n}",
|
||||
"есептелмеді: берілген позициядан — {n}",
|
||||
],
|
||||
[
|
||||
"Book: could not open — {reason}",
|
||||
"Книга: не открылась — {reason}",
|
||||
"Livre : ouverture impossible — {reason}",
|
||||
"Buch: konnte nicht geöffnet werden — {reason}",
|
||||
"Libro: no se pudo abrir — {reason}",
|
||||
"Libro: impossibile aprire — {reason}",
|
||||
"Livro: não foi possível abrir — {reason}",
|
||||
"Kitob: ochilmadi — {reason}",
|
||||
"Кітап: ашылмады — {reason}",
|
||||
],
|
||||
[
|
||||
"Opening: {n} moves",
|
||||
"Дебют: {n} ходов",
|
||||
|
|
@ -14993,17 +14916,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"oxirgisi {date}",
|
||||
"соңғысы {date}",
|
||||
],
|
||||
[
|
||||
"leaves the book at move {n}, first in {p} % of games",
|
||||
"из книги выходит на {n}-м ходу, первым — в {p} % партий",
|
||||
"quitte le livre au coup {n}, le premier dans {p} % des parties",
|
||||
"verlässt das Buch bei Zug {n}, als Erster in {p} % der Partien",
|
||||
"deja el libro en la jugada {n}, el primero en el {p} % de las partidas",
|
||||
"lascia il libro alla mossa {n}, per primo nel {p} % delle partite",
|
||||
"deixa o livro no lance {n}, primeiro em {p} % das partidas",
|
||||
"kitobdan {n}-yurishda chiqadi, partiyalarning {p} % ida birinchi bo‘lib",
|
||||
"кітаптан {n}-жүрісте шығады, партиялардың {p} % інде бірінші болып",
|
||||
],
|
||||
[
|
||||
"Few games ({n}): percentages and scores are unreliable",
|
||||
"Партий мало ({n}) — проценты и счёт ненадёжны",
|
||||
|
|
@ -15059,17 +14971,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Boshqa tartibda ham kelingan: {orders}",
|
||||
"Басқа жүріс ретімен де келген: {orders}",
|
||||
],
|
||||
[
|
||||
"Here he leaves the book: in “{book}” this position occurs {n} times",
|
||||
"Здесь он выходит из книги: в «{book}» такая позиция встречается {n} раз",
|
||||
"Ici il quitte le livre : dans « {book} » cette position apparaît {n} fois",
|
||||
"Hier verlässt er das Buch: in „{book}“ kommt diese Stellung {n}-mal vor",
|
||||
"Aquí deja el libro: en «{book}» esta posición aparece {n} veces",
|
||||
"Qui lascia il libro: in «{book}» questa posizione compare {n} volte",
|
||||
"Aqui ele deixa o livro: em «{book}» esta posição aparece {n} vezes",
|
||||
"Bu yerda u kitobdan chiqadi: «{book}» da bu pozitsiya {n} marta uchraydi",
|
||||
"Мұнда ол кітаптан шығады: «{book}» ішінде бұл позиция {n} рет кездеседі",
|
||||
],
|
||||
[
|
||||
"No games as {colour}. As {other} — {n}",
|
||||
"{colour} партий нет. {other} — {n}",
|
||||
|
|
@ -15301,17 +15202,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Noaniqliklarni (?!) xato va qo‘pol xatolar bilan ko‘rsatish",
|
||||
"Дәлсіздіктерді (?!) қателер мен өрескел қателермен бірге көрсету",
|
||||
],
|
||||
[
|
||||
"Book: {name}",
|
||||
"Книга: {name}",
|
||||
"Livre : {name}",
|
||||
"Buch: {name}",
|
||||
"Libro: {name}",
|
||||
"Libro: {name}",
|
||||
"Livro: {name}",
|
||||
"Kitob: {name}",
|
||||
"Кітап: {name}",
|
||||
],
|
||||
[
|
||||
"White wins {w} % · draws {d} % · Black wins {b} %",
|
||||
"Победы белых {w} % · ничьи {d} % · победы чёрных {b} %",
|
||||
|
|
@ -15722,72 +15612,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Qaysi partiyalarini olish: vaqt bo‘yicha — oxirgi partiyasidan orqaga sanab; soni bo‘yicha — har bir rangda eng yangilari",
|
||||
"Қай партияларын алу: уақыт бойынша — соңғы партиясынан кері санап; саны бойынша — әр түспен ең жаңалары",
|
||||
],
|
||||
[
|
||||
"★ Save",
|
||||
"★ Сохранить",
|
||||
"★ Enregistrer",
|
||||
"★ Speichern",
|
||||
"★ Guardar",
|
||||
"★ Salva",
|
||||
"★ Salvar",
|
||||
"★ Saqlash",
|
||||
"★ Сақтау",
|
||||
],
|
||||
[
|
||||
"★ Saved",
|
||||
"★ Сохранено",
|
||||
"★ Enregistrée",
|
||||
"★ Gespeichert",
|
||||
"★ Guardada",
|
||||
"★ Salvata",
|
||||
"★ Salva",
|
||||
"★ Saqlandi",
|
||||
"★ Сақталды",
|
||||
],
|
||||
[
|
||||
"Kept in the library's «Preparations»: changes are saved by themselves",
|
||||
"Лежит в «Подготовках» библиотеки: изменения сохраняются сами",
|
||||
"Rangée dans « Préparations » de la bibliothèque : les changements s’enregistrent d’eux-mêmes",
|
||||
"In den «Vorbereitungen» der Bibliothek: Änderungen werden von selbst gespeichert",
|
||||
"Está en «Preparaciones» de la biblioteca: los cambios se guardan solos",
|
||||
"Si trova in «Preparazioni» della libreria: le modifiche si salvano da sole",
|
||||
"Está em «Preparações» da biblioteca: as mudanças são salvas sozinhas",
|
||||
"Kutubxonaning «Tayyorgarliklar» bo‘limida: o‘zgarishlar o‘zi saqlanadi",
|
||||
"Кітапхананың «Дайындықтар» бөлімінде: өзгерістер өздігінен сақталады",
|
||||
],
|
||||
[
|
||||
"Keep this preparation with the errors found: the library's «Preparations» opens it again",
|
||||
"Сохранить подготовку вместе с найденными ошибками: её можно снова открыть в «Подготовках» библиотеки",
|
||||
"Garder cette préparation avec les erreurs trouvées : « Préparations » de la bibliothèque la rouvre",
|
||||
"Diese Vorbereitung mit den gefundenen Fehlern behalten: die «Vorbereitungen» der Bibliothek öffnen sie wieder",
|
||||
"Guardar esta preparación con los errores encontrados: «Preparaciones» de la biblioteca la vuelve a abrir",
|
||||
"Conserva questa preparazione con gli errori trovati: «Preparazioni» della libreria la riapre",
|
||||
"Guardar esta preparação com os erros encontrados: «Preparações» da biblioteca a abre de novo",
|
||||
"Tayyorgarlikni topilgan xatolar bilan saqlash: uni kutubxonaning «Tayyorgarliklar» bo‘limida qayta ochish mumkin",
|
||||
"Дайындықты табылған қателермен сақтау: оны кітапхананың «Дайындықтар» бөлімінде қайта ашуға болады",
|
||||
],
|
||||
[
|
||||
"Saved: the library's «Preparations» opens it",
|
||||
"Сохранено: открыть можно в «Подготовках» библиотеки",
|
||||
"Enregistrée : « Préparations » de la bibliothèque l’ouvre",
|
||||
"Gespeichert: die «Vorbereitungen» der Bibliothek öffnen sie",
|
||||
"Guardada: se abre en «Preparaciones» de la biblioteca",
|
||||
"Salvata: si apre da «Preparazioni» della libreria",
|
||||
"Salva: abra em «Preparações» da biblioteca",
|
||||
"Saqlandi: kutubxonaning «Tayyorgarliklar» bo‘limida ochiladi",
|
||||
"Сақталды: кітапхананың «Дайындықтар» бөлімінде ашылады",
|
||||
],
|
||||
[
|
||||
"Could not save: {e}",
|
||||
"Не удалось сохранить: {e}",
|
||||
"Impossible d’enregistrer : {e}",
|
||||
"Speichern fehlgeschlagen: {e}",
|
||||
"No se pudo guardar: {e}",
|
||||
"Impossibile salvare: {e}",
|
||||
"Não foi possível salvar: {e}",
|
||||
"Saqlab bo‘lmadi: {e}",
|
||||
"Сақтау мүмкін болмады: {e}",
|
||||
],
|
||||
[
|
||||
"Preparations",
|
||||
"Подготовки",
|
||||
|
|
@ -15822,15 +15646,26 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Қарсыластарға дайындықтар: сақталғандары және жаңасы",
|
||||
],
|
||||
[
|
||||
"Nothing saved yet. Prepare against a player and press «Save» on the report.",
|
||||
"Пока ничего не сохранено. Подготовьтесь к игроку и нажмите «Сохранить» в отчёте.",
|
||||
"Rien d’enregistré pour l’instant. Préparez-vous contre un joueur et appuyez sur « Enregistrer » dans le rapport.",
|
||||
"Noch nichts gespeichert. Bereiten Sie sich auf einen Spieler vor und drücken Sie im Bericht «Speichern».",
|
||||
"Aún no hay nada guardado. Prepárese contra un jugador y pulse «Guardar» en el informe.",
|
||||
"Ancora niente di salvato. Preparati contro un giocatore e premi «Salva» nel rapporto.",
|
||||
"Nada salvo ainda. Prepare-se contra um jogador e pressione «Salvar» no relatório.",
|
||||
"Hali hech narsa saqlanmagan. O‘yinchiga tayyorlaning va hisobotda «Saqlash» tugmasini bosing.",
|
||||
"Әзірге ештеңе сақталмаған. Ойыншыға дайындалып, есепте «Сақтау» түймесін басыңыз.",
|
||||
"Nothing yet. A preparation is saved by itself as soon as you start it: prepare against a player.",
|
||||
"Пока пусто. Подготовка сохраняется сама сразу при запуске: подготовьтесь к сопернику.",
|
||||
"Rien pour l’instant. Une préparation s’enregistre d’elle-même dès son lancement : préparez-vous contre un joueur.",
|
||||
"Noch nichts. Eine Vorbereitung wird von selbst gespeichert, sobald sie begonnen wird: bereiten Sie sich auf einen Spieler vor.",
|
||||
"Nada todavía. Una preparación se guarda sola en cuanto la inicias: prepárate contra un jugador.",
|
||||
"Ancora niente. Una preparazione si salva da sola appena la avvii: preparati contro un giocatore.",
|
||||
"Nada ainda. Uma preparação é guardada sozinha assim que a inicias: prepara-te contra um jogador.",
|
||||
"Hozircha bo‘sh. Tayyorgarlik boshlanishi bilan o‘zi saqlanadi: raqibga tayyorlaning.",
|
||||
"Әзірге бос. Дайындық басталғанымен өзі сақталады: қарсыласқа дайындалыңыз.",
|
||||
],
|
||||
[
|
||||
"Could not save: {e}",
|
||||
"Не удалось сохранить: {e}",
|
||||
"Impossible d’enregistrer : {e}",
|
||||
"Speichern fehlgeschlagen: {e}",
|
||||
"No se pudo guardar: {e}",
|
||||
"Impossibile salvare: {e}",
|
||||
"Não foi possível salvar: {e}",
|
||||
"Saqlab bo‘lmadi: {e}",
|
||||
"Сақтау мүмкін болмады: {e}",
|
||||
],
|
||||
[
|
||||
"♟ New preparation…",
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ pub struct SavedPrep {
|
|||
pub plies: usize,
|
||||
pub period: Period,
|
||||
pub color: ColorChoice,
|
||||
/// The book as the setting keeps it (`BookChoice::setting`).
|
||||
/// Unused legacy book choice, preserved when old preparations are saved again.
|
||||
#[serde(default)]
|
||||
pub book: PathBuf,
|
||||
/// Seconds since 1970, of the last save.
|
||||
pub saved: u64,
|
||||
|
|
@ -119,8 +120,14 @@ pub fn save(dir: &Path, meta: &SavedPrep, report: &PrepReport) -> std::io::Resul
|
|||
let id = id(&meta.path, &meta.names);
|
||||
let bytes = serde_json::to_vec(report).map_err(std::io::Error::other)?;
|
||||
write_atomic(&report_path(dir, &id), &bytes)?;
|
||||
save_meta(dir, meta)
|
||||
}
|
||||
|
||||
/// Writes only the list entry: a preparation is kept from the moment it is started,
|
||||
/// before its report is built.
|
||||
pub fn save_meta(dir: &Path, meta: &SavedPrep) -> std::io::Result<()> {
|
||||
let bytes = serde_json::to_vec_pretty(meta).map_err(std::io::Error::other)?;
|
||||
write_atomic(&meta_path(dir, &id), &bytes)
|
||||
write_atomic(&meta_path(dir, &id(&meta.path, &meta.names)), &bytes)
|
||||
}
|
||||
|
||||
/// A new name in the list.
|
||||
|
|
@ -200,6 +207,41 @@ mod tests {
|
|||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_book_choice_is_preserved() {
|
||||
let dir = std::env::temp_dir().join(format!("cp-prep-legacy-book-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
let mut a = meta("/db/a.pgn", [7], "Вафин", 10);
|
||||
a.book = PathBuf::from("/db/book.pgn");
|
||||
save_meta(&dir, &a).expect("save_meta");
|
||||
let ida = id(&a.path, &a.names);
|
||||
let path = meta_path(&dir, &ida);
|
||||
let json = std::fs::read_to_string(&path).expect("metadata");
|
||||
let without_book = json.replace(&format!("\"book\": \"{}\",", a.book.display()), "");
|
||||
std::fs::write(&path, without_book).expect("legacy metadata");
|
||||
let mut loaded = get(&dir, &ida).expect("defaulted legacy book");
|
||||
assert_eq!(loaded.book, PathBuf::new());
|
||||
loaded.book = a.book.clone();
|
||||
save_meta(&dir, &loaded).expect("save legacy book");
|
||||
assert_eq!(get(&dir, &ida).expect("metadata").book, a.book);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn started_preparation_is_listed_before_its_report_exists() {
|
||||
let dir = std::env::temp_dir().join(format!("cp-prep-meta-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
let a = meta("/db/a.pgn", [7], "Вафин", 10);
|
||||
save_meta(&dir, &a).expect("save_meta");
|
||||
assert_eq!(list(&dir).len(), 1, "in the list from the start");
|
||||
let ida = id(&a.path, &a.names);
|
||||
assert!(super::report(&dir, &ida).is_none(), "no report yet");
|
||||
let report: PrepReport = serde_json::from_str(REPORT).expect("report");
|
||||
save(&dir, &a, &report).expect("save");
|
||||
assert!(super::report(&dir, &ida).is_some());
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
const REPORT: &str = r#"{"version":4,"fingerprint":1,"player":{"ids":[7]},"names":["A"],
|
||||
"plies":20,"side_white":true,"side_black":true,"games":[],"skipped":0,"openings":[],
|
||||
"white":{"white":true,"games":[],"tree":{"nodes":[]},"families":[],"errors":[],
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -165,7 +165,7 @@ pub struct Settings {
|
|||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct PrepSettings {
|
||||
/// The book (`None`: the largest database on the shelf; `Some("")`: no book).
|
||||
/// Unused legacy book choice, preserved when old settings are saved again.
|
||||
pub book: Option<PathBuf>,
|
||||
/// Plies of the opening the report looks at.
|
||||
pub plies: usize,
|
||||
|
|
@ -173,8 +173,6 @@ pub struct PrepSettings {
|
|||
pub period: prep::Period,
|
||||
/// Moves with fewer games fold into «other moves».
|
||||
pub branches_from: u32,
|
||||
/// The colour was chosen in the dialog once: the button starts the engine at once.
|
||||
pub chosen: bool,
|
||||
/// Inaccuracies (?!) are shown with the mistakes and blunders.
|
||||
pub inaccuracies: bool,
|
||||
/// The order of each table of the screen.
|
||||
|
|
@ -188,7 +186,6 @@ impl Default for PrepSettings {
|
|||
plies: 20,
|
||||
period: prep::Period::All,
|
||||
branches_from: 3,
|
||||
chosen: false,
|
||||
inaccuracies: true,
|
||||
sorts: Default::default(),
|
||||
}
|
||||
|
|
@ -355,13 +352,15 @@ mod tests {
|
|||
let old = r#"{
|
||||
"language": "Ru",
|
||||
"review": {"quality": 2, "threads": 12, "hash_mb": 1024, "chosen": true},
|
||||
"prep": {"quality": 1, "plies": 16, "chosen": true}
|
||||
"prep": {"quality": 1, "plies": 16, "chosen": true, "book": "/db/book.pgn"}
|
||||
}"#;
|
||||
let s: Settings = serde_json::from_str(old).expect("read");
|
||||
assert_eq!(s.language, Lang::Ru);
|
||||
assert_eq!(s.prep.plies, 16);
|
||||
assert!(s.prep.chosen);
|
||||
assert_eq!(s.prep.book, Some(PathBuf::from("/db/book.pgn")));
|
||||
let json = serde_json::to_string(&s).expect("written");
|
||||
assert!(!json.contains("\"review\"") && !json.contains("quality"));
|
||||
assert!(!json.contains("\"chosen\""));
|
||||
assert!(json.contains("\"book\":\"/db/book.pgn\""));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue