fix: harden reminders and state handling
This commit is contained in:
@@ -17,7 +17,8 @@ import { adjustNextFireAt } from './adaptive'
|
||||
|
||||
/**
|
||||
* Сколько reps пользователь сделал по упражнению `ex` за сегодня (local day).
|
||||
* Учитываем actualReps если задано (частичное выполнение), иначе planned reps.
|
||||
* Учитываем actualReps если задано (частичное выполнение), затем snapshot
|
||||
* reps из истории, и только потом текущие planned reps упражнения.
|
||||
*/
|
||||
function repsDoneToday(ex: Exercise, history: HistoryEntry[]): number {
|
||||
const todayKey = new Date()
|
||||
@@ -28,7 +29,7 @@ function repsDoneToday(ex: Exercise, history: HistoryEntry[]): number {
|
||||
if (e.action !== 'done') continue
|
||||
if (e.exerciseId !== ex.id) continue
|
||||
if (e.ts < startMs) continue
|
||||
sum += e.actualReps ?? ex.reps
|
||||
sum += e.actualReps ?? e.reps ?? ex.reps
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user