[insight] Goals and rewards: a goal this month (its tank, what is needed, the pace, the split between its ways, where money could come from), medals and challenges from complete periods, the cancel letter in Czech

This commit is contained in:
2026-11-07 22:39:54 +01:00
parent c3cb1dd060
commit 03d2afd4dc
9 changed files with 1079 additions and 20 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ pub fn analyse(state: &State, today: Date) -> Insight {
let full: Vec<&EffectivePayment> = charges.iter().copied().filter(|p| cost(p) > TRIAL_MAX).collect();
// Trials: the last card check with no full charge after it, or a payment marked by hand.
let last_check = charges.iter().filter(|p| cost(p) <= TRIAL_MAX).next_back();
let last_check = charges.iter().rfind(|p| cost(p) <= TRIAL_MAX);
for p in charges.iter().filter(|p| p.trial_ends.is_some() || Some(*p) == last_check) {
let converted = full.iter().any(|f| f.date > p.date && f.id != p.id);
let (ends, estimated) = match p.trial_ends {