Sort the cards by Mastery Points or A to Z and remember the choice (#76)

The statistics rows carry the Mastery Points: None for an Account whose
points were never fetched, Some(0) for a champion missing from the last
list. One card order, computed only when the statistics or the preference
change, feeds the home grid, the Anvil row and « Autres champions ». The
sort selector stays visible during a champ select, the choice is saved
with the other preferences, and the sheet shows the Mastery Points
(unknown ones after the known, and not as zero).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nessarandClaude Opus 5.5 committed 2026-11-21 02:26:14 +01:00
1 parent 815daf33cb
commit a457a19fe5
11 files changed
+857 -55

No files matched your search

+11
View File
@@ -76,6 +76,10 @@ pub struct ChampionRow {
/// Season scope: always `Some`, zeros for a champion never played. All Seasons: `None`.
/// Not affected by the Format filter.
pub challenge: Option<ChampionChallenge>,
/// The Account's Mastery Points on this champion. `None` = unknown for this Account (the
/// points were never fetched); `Some(0)` = known, no points. Not affected by the Season
/// nor the Format.
pub mastery_points: Option<u64>,
}
/// What the champion card shows: the Challenge figures of one champion for one Account and
@@ -340,6 +344,7 @@ pub(crate) fn compute(
attempts,
state,
challenge,
mastery_points: None,
champion,
}
})
@@ -434,6 +439,12 @@ impl Tracker {
season_period,
scope.format,
);
// A read error leaves the points unknown rather than failing the statistics.
if let Ok(Some(points)) = self.mastery(puuid) {
for row in &mut stats.rows {
row.mastery_points = Some(points.get(&row.champion.id).copied().unwrap_or(0));
}
}
if let Some((_, dir)) = &self.champions {
for row in &mut stats.rows {
let path = dir.join(format!("{}.png", row.champion.key));