feat: last-session recall when starting an exercise

When you start an exercise, the Mini App now fetches the most
recent time you logged it and shows a hint line in the sets card
("Last time: 8×60, 6×60, 5×60 · 3 days ago"), plus pre-fills the
weight input with the last set's weight.

- db.get_last_exercise(user_id, name): most recent non-deleted
  entry, case-insensitive name match, sets_detail parsed.
- GET /api/exercises/last?name=<name>.
- webapp: loadLastSession() on startExercise + draft restore;
  hint cleared on editExercise (the set rows are the reference
  there). Pre-fill only when the weight field is empty and no
  sets logged yet, so it never clobbers user input.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Danny 2026-05-22 12:52:37 +02:00
parent 5e3636201f
commit 9f146d60fa
6 changed files with 168 additions and 1 deletions

View file

@ -241,6 +241,15 @@ body {
font-variant-numeric: tabular-nums;
}
.last-session-hint {
margin-top: 6px;
font-size: 12px;
color: var(--tg-theme-hint-color, #999);
background: var(--tg-theme-bg-color, #fff);
border-radius: 8px;
padding: 6px 10px;
}
.btn-danger {
color: #e53935 !important;
font-size: 12px !important;