opening trainer: table columns «Today» (review N / new: N / when) and «Passed» (bar at a fixed place, A/Y); «passed / consolidated» wording in the card, the summary and Lines
This commit is contained in:
parent
613d14bfdd
commit
27217322ed
6 changed files with 175 additions and 167 deletions
|
|
@ -216,17 +216,6 @@ pub fn trf(key: &'static str, args: &[(&str, &dyn Display)]) -> String {
|
|||
// [English, Русский, Français, Deutsch, Español, Italiano, Português (BR), O‘zbekcha, Қазақша]
|
||||
// Uzbek o‘ and g‘ are written with ‘ (U+2018): the interface font has no U+02BB.
|
||||
const ROWS: &[[&str; 9]] = &[
|
||||
[
|
||||
"Learned",
|
||||
"Выучено",
|
||||
"Appris",
|
||||
"Gelernt",
|
||||
"Aprendidas",
|
||||
"Imparate",
|
||||
"Aprendidas",
|
||||
"O‘rganildi",
|
||||
"Үйренілді",
|
||||
],
|
||||
[
|
||||
"You play White",
|
||||
"Вы играете белыми",
|
||||
|
|
@ -403,17 +392,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"⬅ Partiyaga",
|
||||
"⬅ Партияға",
|
||||
],
|
||||
[
|
||||
"Below: {n} lines · {y} your moves · learned {x}",
|
||||
"Дальше: вариантов {n} · ваших ходов {y} · выучено {x}",
|
||||
"En dessous : {n} lignes · {y} de vos coups · {x} appris",
|
||||
"Darunter: {n} Varianten · {y} eigene Züge · {x} gelernt",
|
||||
"Debajo: {n} líneas · {y} jugadas tuyas · {x} aprendidas",
|
||||
"Sotto: {n} linee · {y} tue mosse · {x} imparate",
|
||||
"Abaixo: {n} linhas · {y} lances seus · {x} aprendidos",
|
||||
"Keyin: {n} ta variant · sizning {y} ta yurishingiz · {x} tasi o‘rganilgan",
|
||||
"Әрі қарай: {n} нұсқа · сіздің {y} жүрісіңіз · {x} үйренілді",
|
||||
],
|
||||
[
|
||||
"Lines · {n} lines · {y} your moves",
|
||||
"Варианты · вариантов: {n} · ваших ходов: {y}",
|
||||
|
|
@ -810,17 +788,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Shox: {path}",
|
||||
"Тармақ: {path}",
|
||||
],
|
||||
[
|
||||
"Learning",
|
||||
"Учится",
|
||||
"En cours",
|
||||
"In Arbeit",
|
||||
"En curso",
|
||||
"In corso",
|
||||
"Em andamento",
|
||||
"O‘rganilmoqda",
|
||||
"Үйренілуде",
|
||||
],
|
||||
[
|
||||
"no moves",
|
||||
"нет ходов",
|
||||
|
|
@ -844,26 +811,92 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Репертуарда әзірге жүріс жоқ: PGN импорттаңыз немесе партиядан желі қосыңыз",
|
||||
],
|
||||
[
|
||||
"Learned {x}, learning {z}, {y} moves in all. A move counts as learned after three correct answers in a row without a hint — usually over several days of reviews.",
|
||||
"Выучено {x}, учится {z}, всего {y} ходов. Ход считается выученным после трёх верных ответов подряд без подсказки — обычно за несколько дней повторений.",
|
||||
"Appris {x}, en cours {z}, {y} coups au total. Un coup est appris après trois bonnes réponses d’affilée sans indice — en général sur plusieurs jours de révisions.",
|
||||
"Gelernt {x}, in Arbeit {z}, insgesamt {y} Züge. Ein Zug gilt als gelernt nach drei richtigen Antworten in Folge ohne Hinweis — meist über mehrere Tage Wiederholung.",
|
||||
"Aprendidas {x}, en curso {z}, {y} jugadas en total. Una jugada se da por aprendida tras tres respuestas correctas seguidas sin pista; normalmente en varios días de repaso.",
|
||||
"Imparate {x}, in corso {z}, {y} mosse in tutto. Una mossa è imparata dopo tre risposte giuste di fila senza suggerimento — di solito in alcuni giorni di ripasso.",
|
||||
"Aprendidos {x}, em andamento {z}, {y} lances no total. Um lance conta como aprendido após três respostas certas seguidas sem dica — normalmente em vários dias de revisão.",
|
||||
"O‘rganilgan {x}, o‘rganilmoqda {z}, jami {y} yurish. Yurish ketma-ket uchta to‘g‘ri javobdan keyin (yordamsiz) o‘rganilgan hisoblanadi — odatda bir necha kunlik takrorlashda.",
|
||||
"Үйренілген {x}, үйренілуде {z}, барлығы {y} жүріс. Жүріс кеңессіз қатарынан үш дұрыс жауаптан кейін үйренілген саналады — әдетте бірнеше күндік қайталауда.",
|
||||
"review {n}",
|
||||
"повторить {n}",
|
||||
"réviser {n}",
|
||||
"{n} wiederholen",
|
||||
"repasar {n}",
|
||||
"ripassare {n}",
|
||||
"revisar {n}",
|
||||
"takrorlash {n}",
|
||||
"қайталау {n}",
|
||||
],
|
||||
[
|
||||
"Progress",
|
||||
"Прогресс",
|
||||
"Progression",
|
||||
"Fortschritt",
|
||||
"Progreso",
|
||||
"Progressi",
|
||||
"Progresso",
|
||||
"Taraqqiyot",
|
||||
"Ілгерілеу",
|
||||
"new: {n}",
|
||||
"новые: {n}",
|
||||
"nouveaux : {n}",
|
||||
"neu: {n}",
|
||||
"nuevas: {n}",
|
||||
"nuove: {n}",
|
||||
"novos: {n}",
|
||||
"yangi: {n}",
|
||||
"жаңа: {n}",
|
||||
],
|
||||
[
|
||||
"To review {n}, new in the session {m}",
|
||||
"К повторению {n}, новых в занятие {m}",
|
||||
"À réviser {n}, nouveaux dans la séance {m}",
|
||||
"Zu wiederholen {n}, neu in der Einheit {m}",
|
||||
"Por repasar {n}, nuevas en la sesión {m}",
|
||||
"Da ripassare {n}, nuove nella sessione {m}",
|
||||
"Para revisar {n}, novos na sessão {m}",
|
||||
"Takrorlash uchun {n}, mashg‘ulotda yangi {m}",
|
||||
"Қайталауға {n}, сабақта жаңа {m}",
|
||||
],
|
||||
[
|
||||
"Passed",
|
||||
"Пройдено",
|
||||
"Vus",
|
||||
"Durchgenommen",
|
||||
"Vistas",
|
||||
"Viste",
|
||||
"Vistos",
|
||||
"O‘tilgan",
|
||||
"Өтілген",
|
||||
],
|
||||
[
|
||||
"Consolidated",
|
||||
"Закреплено",
|
||||
"Consolidés",
|
||||
"Gefestigt",
|
||||
"Consolidadas",
|
||||
"Consolidate",
|
||||
"Consolidados",
|
||||
"Mustahkamlangan",
|
||||
"Бекітілген",
|
||||
],
|
||||
[
|
||||
"Passed {a} of {y} moves · consolidated {l}",
|
||||
"Пройдено {a} из {y} ходов · закреплено {l}",
|
||||
"{a} coups vus sur {y} · {l} consolidés",
|
||||
"{a} von {y} Zügen durchgenommen · {l} gefestigt",
|
||||
"{a} de {y} jugadas vistas · {l} consolidadas",
|
||||
"{a} mosse viste su {y} · {l} consolidate",
|
||||
"{a} de {y} lances vistos · {l} consolidados",
|
||||
"{y} ta yurishdan {a} tasi o‘tilgan · {l} tasi mustahkamlangan",
|
||||
"{y} жүрістің {a} өтілген · {l} бекітілген",
|
||||
],
|
||||
[
|
||||
"Passed {a} of {y} moves, {l} of them consolidated. A move is consolidated after three correct answers in a row without a hint — usually over several days of reviews.",
|
||||
"Пройдено {a} из {y} ходов, из них закреплено {l}. Ход закреплён после трёх верных ответов подряд без подсказки — обычно за несколько дней повторений.",
|
||||
"{a} coups vus sur {y}, dont {l} consolidés. Un coup est consolidé après trois bonnes réponses d’affilée sans indice — en général sur plusieurs jours de révisions.",
|
||||
"{a} von {y} Zügen durchgenommen, davon {l} gefestigt. Ein Zug ist gefestigt nach drei richtigen Antworten in Folge ohne Hinweis — meist über mehrere Tage Wiederholung.",
|
||||
"{a} de {y} jugadas vistas, {l} de ellas consolidadas. Una jugada queda consolidada tras tres respuestas correctas seguidas sin pista; normalmente en varios días de repaso.",
|
||||
"{a} mosse viste su {y}, di cui {l} consolidate. Una mossa è consolidata dopo tre risposte giuste di fila senza suggerimento — di solito in alcuni giorni di ripasso.",
|
||||
"{a} de {y} lances vistos, {l} deles consolidados. Um lance fica consolidado após três respostas certas seguidas sem dica — normalmente em vários dias de revisão.",
|
||||
"{y} ta yurishdan {a} tasi o‘tilgan, ulardan {l} tasi mustahkamlangan. Yurish ketma-ket uchta to‘g‘ri javobdan keyin (yordamsiz) mustahkamlanadi — odatda bir necha kunlik takrorlashda.",
|
||||
"{y} жүрістің {a} өтілген, оның {l} бекітілген. Жүріс кеңессіз қатарынан үш дұрыс жауаптан кейін бекітіледі — әдетте бірнеше күндік қайталауда.",
|
||||
],
|
||||
[
|
||||
"Below: {n} lines · {y} your moves · consolidated {x}",
|
||||
"Дальше: вариантов {n} · ваших ходов {y} · закреплено {x}",
|
||||
"En dessous : {n} lignes · {y} de vos coups · {x} consolidés",
|
||||
"Darunter: {n} Varianten · {y} eigene Züge · {x} gefestigt",
|
||||
"Debajo: {n} líneas · {y} jugadas tuyas · {x} consolidadas",
|
||||
"Sotto: {n} linee · {y} tue mosse · {x} consolidate",
|
||||
"Abaixo: {n} linhas · {y} lances seus · {x} consolidados",
|
||||
"Keyin: {n} ta variant · sizning {y} ta yurishingiz · {x} tasi mustahkamlangan",
|
||||
"Әрі қарай: {n} нұсқа · сіздің {y} жүрісіңіз · {x} бекітілген",
|
||||
],
|
||||
[
|
||||
"New moves left",
|
||||
|
|
@ -1360,17 +1393,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Repertuarlarni o‘qib bo‘lmadi: {e}",
|
||||
"Репертуарларды оқу мүмкін болмады: {e}",
|
||||
],
|
||||
[
|
||||
"{n} to review, {m} new",
|
||||
"Повторить: {n}, новых: {m}",
|
||||
"{n} à réviser, {m} nouveaux",
|
||||
"{n} zu wiederholen, {m} neu",
|
||||
"{n} para repasar, {m} nuevas",
|
||||
"{n} da ripassare, {m} nuove",
|
||||
"{n} para revisar, {m} novos",
|
||||
"Takrorlash: {n}, yangi: {m}",
|
||||
"Қайталау: {n}, жаңа: {m}",
|
||||
],
|
||||
[
|
||||
"Play “{name}” as Black?",
|
||||
"Играть «{name}» чёрными?",
|
||||
|
|
@ -1525,28 +1547,6 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"{m} ta yangisini o‘rganish",
|
||||
"{m} жаңасын үйрену",
|
||||
],
|
||||
[
|
||||
"Learned {x} of {y} moves",
|
||||
"Выучено {x} из {y} ходов",
|
||||
"{x} coups appris sur {y}",
|
||||
"{x} von {y} Zügen gelernt",
|
||||
"{x} de {y} jugadas aprendidas",
|
||||
"{x} mosse imparate su {y}",
|
||||
"{x} de {y} lances aprendidos",
|
||||
"{y} ta yurishdan {x} tasi o‘rganildi",
|
||||
"{y} жүрістің {x} үйренілді",
|
||||
],
|
||||
[
|
||||
"learning {k}",
|
||||
"учится {k}",
|
||||
"en cours {k}",
|
||||
"in Arbeit {k}",
|
||||
"en curso {k}",
|
||||
"in corso {k}",
|
||||
"em andamento {k}",
|
||||
"o‘rganilmoqda {k}",
|
||||
"үйренілуде {k}",
|
||||
],
|
||||
[
|
||||
"Add PGN to “{name}”",
|
||||
"Добавить PGN в «{name}»",
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ impl OpeningLinesUi {
|
|||
} else {
|
||||
let text = match self.below(&path) {
|
||||
Some((lines, mine, learnt)) => trf(
|
||||
"Below: {n} lines · {y} your moves · learned {x}",
|
||||
"Below: {n} lines · {y} your moves · consolidated {x}",
|
||||
&[("n", &lines), ("y", &mine), ("x", &learnt)],
|
||||
),
|
||||
None => tr("Counting moves…").to_owned(),
|
||||
|
|
|
|||
|
|
@ -210,9 +210,10 @@ enum State {
|
|||
/// Computed once when the result is shown.
|
||||
struct Summary {
|
||||
next_review: String,
|
||||
/// How many more moves are learned, and learning, than when the session began.
|
||||
learnt_gain: usize,
|
||||
learning_gain: usize,
|
||||
/// How many more moves are passed (met at least once) and consolidated than when
|
||||
/// the session began.
|
||||
passed_gain: usize,
|
||||
consolidated_gain: usize,
|
||||
/// Moves never shown yet, all of them (the «more new» button takes up to 10).
|
||||
unseen: usize,
|
||||
more_new: usize,
|
||||
|
|
@ -1640,8 +1641,9 @@ impl OpeningSessionUi {
|
|||
let (learnt, learning) = progress_counts(&self.library, &self.learning, &self.whole_scope);
|
||||
self.summary = Some(Summary {
|
||||
next_review,
|
||||
learnt_gain: learnt.saturating_sub(self.start_progress.0),
|
||||
learning_gain: learning.saturating_sub(self.start_progress.1),
|
||||
passed_gain: (learnt + learning)
|
||||
.saturating_sub(self.start_progress.0 + self.start_progress.1),
|
||||
consolidated_gain: learnt.saturating_sub(self.start_progress.0),
|
||||
unseen,
|
||||
more_new: unseen.min(layout::NEW_PER_SESSION),
|
||||
});
|
||||
|
|
@ -1926,11 +1928,16 @@ impl OpeningSessionUi {
|
|||
ui.separator();
|
||||
ui.add_space(4.0);
|
||||
if let Some(summary) = &self.summary {
|
||||
// Learned takes days: what the session did shows as «learning».
|
||||
if summary.learnt_gain > 0 {
|
||||
row(ui, tr("Learned"), format!("+{}", summary.learnt_gain));
|
||||
} else if summary.learning_gain > 0 {
|
||||
row(ui, tr("Learning"), format!("+{}", summary.learning_gain));
|
||||
// Consolidating takes days: what the session did shows as «passed».
|
||||
if summary.passed_gain > 0 {
|
||||
row(ui, tr("Passed"), format!("+{}", summary.passed_gain));
|
||||
}
|
||||
if summary.consolidated_gain > 0 {
|
||||
row(
|
||||
ui,
|
||||
tr("Consolidated"),
|
||||
format!("+{}", summary.consolidated_gain),
|
||||
);
|
||||
}
|
||||
if self.kind == SessionKind::Daily && summary.unseen > 0 {
|
||||
row(ui, tr("New moves left"), summary.unseen.to_string());
|
||||
|
|
|
|||
|
|
@ -2229,7 +2229,7 @@ fn the_summary_shows_learning_growth_when_nothing_is_learned_yet() {
|
|||
assert!(f.ui.is_finished());
|
||||
f.ui.compute_summary();
|
||||
let summary = f.ui.summary.as_ref().unwrap();
|
||||
assert_eq!((summary.learnt_gain, summary.learning_gain), (0, 2));
|
||||
assert_eq!((summary.passed_gain, summary.consolidated_gain), (2, 0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -52,9 +52,10 @@ const BOTTOM_W: f32 = 150.0;
|
|||
const MAIN_W: f32 = 170.0;
|
||||
const LINES_W: f32 = 110.0;
|
||||
const THIRD_W: f32 = 150.0;
|
||||
/// The «Learned» column: a small bar and «X/Y».
|
||||
const LEARNED_W: f32 = 104.0;
|
||||
/// The table's fixed columns: «Today» phrase, the bar, «A/Y» (room for «999/999»).
|
||||
const TODAY_W: f32 = 90.0;
|
||||
const MINI_BAR_W: f32 = 44.0;
|
||||
const PASSED_W: f32 = 64.0;
|
||||
const DIALOG_W: f32 = 460.0;
|
||||
/// A session appears at once when it is ready this fast; otherwise «Preparing…».
|
||||
const PREPARING_SHOWN_AFTER: Duration = Duration::from_millis(300);
|
||||
|
|
@ -88,12 +89,13 @@ struct RowStats {
|
|||
}
|
||||
|
||||
impl RowStats {
|
||||
fn new_today(&self) -> usize {
|
||||
self.unseen.min(NEW_PER_SESSION)
|
||||
/// Moves met in training at least once: learning and learned.
|
||||
fn passed(&self) -> usize {
|
||||
self.learning + self.learnt
|
||||
}
|
||||
|
||||
fn today(&self) -> usize {
|
||||
self.due + self.new_today()
|
||||
fn new_today(&self) -> usize {
|
||||
self.unseen.min(NEW_PER_SESSION)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1679,8 +1681,9 @@ impl RepertoireUi {
|
|||
.cell_layout(egui::Layout::left_to_right(egui::Align::Center))
|
||||
.column(egui_extras::Column::remainder().at_least(80.0).clip(true))
|
||||
.column(egui_extras::Column::exact(22.0))
|
||||
.column(egui_extras::Column::exact(58.0))
|
||||
.column(egui_extras::Column::exact(LEARNED_W))
|
||||
.column(egui_extras::Column::exact(TODAY_W))
|
||||
.column(egui_extras::Column::exact(MINI_BAR_W))
|
||||
.column(egui_extras::Column::exact(PASSED_W))
|
||||
.column(egui_extras::Column::exact(26.0));
|
||||
if let Some(index) = scroll_row {
|
||||
table = table.scroll_to_row(index, None);
|
||||
|
|
@ -1691,13 +1694,18 @@ impl RepertoireUi {
|
|||
ui.add(egui::Label::new(RichText::new(tr("Name")).strong()).truncate());
|
||||
});
|
||||
header.col(|_| {});
|
||||
for key in ["Today", "Progress"] {
|
||||
header.col(|ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
ui.add(egui::Label::new(RichText::new(tr(key)).strong()).truncate());
|
||||
});
|
||||
header.col(|ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
ui.add(egui::Label::new(RichText::new(tr("Today")).strong()).truncate());
|
||||
});
|
||||
}
|
||||
});
|
||||
// «Passed» heads the bar and the number together.
|
||||
header.col(|_| {});
|
||||
header.col(|ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
ui.add(egui::Label::new(RichText::new(tr("Passed")).strong()).truncate());
|
||||
});
|
||||
});
|
||||
header.col(|_| {});
|
||||
})
|
||||
.body(|body| {
|
||||
|
|
@ -1721,26 +1729,25 @@ impl RepertoireUi {
|
|||
row.col(|ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
match stats {
|
||||
// An empty repertoire: «no moves» under «Learned» says it.
|
||||
Some(Ok(_)) if !has_moves => {}
|
||||
Some(Ok(stats)) if stats.today() > 0 => {
|
||||
ui.label(stats.today().to_string()).on_hover_text(trf(
|
||||
"{n} to review, {m} new",
|
||||
Some(Ok(stats)) => {
|
||||
// A call to action in the normal colour; the rest quiet.
|
||||
let text = if stats.due > 0 {
|
||||
RichText::new(trf("review {n}", &[("n", &stats.due)]))
|
||||
} else if stats.new_today() > 0 {
|
||||
RichText::new(trf("new: {n}", &[("n", &stats.new_today())]))
|
||||
.weak()
|
||||
} else if let Some((at, _)) = stats.next {
|
||||
RichText::new(layout::when(at, layout::now())).weak()
|
||||
} else {
|
||||
RichText::new("—").weak()
|
||||
};
|
||||
ui.add(egui::Label::new(text).truncate()).on_hover_text(trf(
|
||||
"To review {n}, new in the session {m}",
|
||||
&[("n", &stats.due), ("m", &stats.new_today())],
|
||||
));
|
||||
}
|
||||
// Nothing today: when the next review is.
|
||||
Some(Ok(RowStats {
|
||||
next: Some((at, _)),
|
||||
..
|
||||
})) => {
|
||||
let when = layout::when(*at, layout::now());
|
||||
ui.add(
|
||||
egui::Label::new(RichText::new(&when).weak()).truncate(),
|
||||
)
|
||||
.on_hover_text(format!("{}: {when}", tr("Next review")));
|
||||
}
|
||||
Some(_) => {
|
||||
Some(Err(_)) => {
|
||||
ui.label(RichText::new("—").weak());
|
||||
}
|
||||
None => {
|
||||
|
|
@ -1749,6 +1756,21 @@ impl RepertoireUi {
|
|||
}
|
||||
});
|
||||
});
|
||||
let passed = matches!(stats, Some(Ok(stats)) if has_moves && stats.total > 0);
|
||||
row.col(|ui| {
|
||||
if let Some(Ok(stats)) = stats
|
||||
&& passed
|
||||
{
|
||||
let room = ui.available_rect_before_wrap();
|
||||
let bar = egui::Rect::from_min_size(
|
||||
egui::pos2(room.left(), room.center().y - 3.0),
|
||||
vec2(MINI_BAR_W, 6.0),
|
||||
);
|
||||
progress_bar(ui, bar, Some(stats), selected);
|
||||
ui.allocate_rect(room, egui::Sense::hover())
|
||||
.on_hover_text(passed_hint(stats));
|
||||
}
|
||||
});
|
||||
row.col(|ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
match stats {
|
||||
|
|
@ -1759,28 +1781,9 @@ impl RepertoireUi {
|
|||
)
|
||||
.on_hover_text(tr("The repertoire has no moves yet: import a PGN or add a line from a game"));
|
||||
}
|
||||
Some(Ok(stats)) if stats.total > 0 => {
|
||||
let hint = learned_hint(stats);
|
||||
// «0/17» reads as «nothing done»: name what is under way.
|
||||
let text = if stats.learnt == 0 && stats.learning > 0 {
|
||||
RichText::new(trf(
|
||||
"learning {k}",
|
||||
&[("k", &stats.learning)],
|
||||
))
|
||||
.weak()
|
||||
} else {
|
||||
RichText::new(format!("{}/{}", stats.learnt, stats.total))
|
||||
};
|
||||
ui.label(text).on_hover_text(&hint);
|
||||
let room = ui.available_width() - ui.spacing().item_spacing.x;
|
||||
if room >= 16.0 {
|
||||
let (bar, response) = ui.allocate_exact_size(
|
||||
vec2(room.min(MINI_BAR_W), 6.0),
|
||||
egui::Sense::hover(),
|
||||
);
|
||||
progress_bar(ui, bar, Some(stats), selected);
|
||||
response.on_hover_text(hint);
|
||||
}
|
||||
Some(Ok(stats)) if passed => {
|
||||
ui.label(format!("{}/{}", stats.passed(), stats.total))
|
||||
.on_hover_text(passed_hint(stats));
|
||||
}
|
||||
Some(_) => {
|
||||
ui.label(RichText::new("—").weak());
|
||||
|
|
@ -2495,18 +2498,18 @@ fn main_button(state: &CardState, side: LearningSide) -> (String, bool, Option<M
|
|||
|
||||
/// Row 3 of the card: learnt, in progress, the rest.
|
||||
/// «Learned 3, learning 10, 75 moves in all» and what «learned» takes.
|
||||
fn learned_hint(stats: &RowStats) -> String {
|
||||
fn passed_hint(stats: &RowStats) -> String {
|
||||
trf(
|
||||
"Learned {x}, learning {z}, {y} moves in all. A move counts as learned after three correct answers in a row without a hint — usually over several days of reviews.",
|
||||
"Passed {a} of {y} moves, {l} of them consolidated. A move is consolidated after three correct answers in a row without a hint — usually over several days of reviews.",
|
||||
&[
|
||||
("x", &stats.learnt),
|
||||
("z", &stats.learning),
|
||||
("a", &stats.passed()),
|
||||
("y", &stats.total),
|
||||
("l", &stats.learnt),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
/// The two segments: learned, then learning (paler).
|
||||
/// Blue — passed, green inside it — consolidated.
|
||||
/// Learned — the green of a correct move; learning — the accent blue; the track stands
|
||||
/// out from the row. On a selected dark row: white, half-white and a dark track.
|
||||
fn progress_bar(ui: &Ui, bar: egui::Rect, stats: Option<&RowStats>, selected: bool) {
|
||||
|
|
@ -2557,19 +2560,17 @@ fn progress(ui: &mut Ui, stats: Option<&RowStats>) {
|
|||
ui.add_space(-2.0);
|
||||
ui.horizontal(|ui| {
|
||||
ui.set_height(20.0);
|
||||
let (learnt, total, learning) = stats.map_or((0, 0, 0), |stats| {
|
||||
(stats.learnt, stats.total, stats.learning)
|
||||
});
|
||||
if stats.is_some() {
|
||||
let mut text = trf("Learned {x} of {y} moves", &[("x", &learnt), ("y", &total)]);
|
||||
// The bar's second segment, named where the bar is read.
|
||||
if learning > 0 {
|
||||
text = format!("{text} · {}", trf("learning {k}", &[("k", &learning)]));
|
||||
}
|
||||
if let Some(stats) = stats {
|
||||
ui.add(egui::Label::new(text).truncate())
|
||||
.on_hover_text(learned_hint(stats));
|
||||
}
|
||||
if let Some(stats) = stats {
|
||||
let text = trf(
|
||||
"Passed {a} of {y} moves · consolidated {l}",
|
||||
&[
|
||||
("a", &stats.passed()),
|
||||
("y", &stats.total),
|
||||
("l", &stats.learnt),
|
||||
],
|
||||
);
|
||||
ui.add(egui::Label::new(text).truncate())
|
||||
.on_hover_text(passed_hint(stats));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ fn today_counts_until_the_end_of_the_day_and_at_most_ten_new() {
|
|||
(12, 2, 9, 3)
|
||||
);
|
||||
assert_eq!(stats.new_today(), 9);
|
||||
assert_eq!(stats.today(), 11);
|
||||
assert_eq!(stats.passed(), 3 + stats.learning);
|
||||
assert_eq!(
|
||||
card_state(Some(true), Some(&Ok(stats.clone()))),
|
||||
CardState::Review { due: 2, new: 9 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue