feat(train): Profile opens on your body, the last 12 weeks and this year (ADR 0030, D60)
Above the days: a card with your body's weight and resting and maximal heart rate, tapped opening Your body; the last 12 weeks' time trained as bars, a week tapped showing its time, distance and workouts; and this calendar year by activity. Home's week card reads its time as the days do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
f04388225b
commit
5cfab59bd2
1 changed files with 713 additions and 46 deletions
|
|
@ -109,4 +109,84 @@ void main() {
|
|||
|
||||
expect(week.longestDay, const Duration(hours: 1));
|
||||
});
|
||||
|
||||
group('the weeks Profile shows (D60)', () {
|
||||
test('twelve, oldest first, the last this one', () {
|
||||
final weeks = weeksBack(
|
||||
[
|
||||
workout(DateTime(2026, 10, 27, 7), moving: const Duration(hours: 1)),
|
||||
workout(DateTime(2026, 8, 12, 7), moving: const Duration(hours: 2)),
|
||||
// Thirteen weeks back: out.
|
||||
workout(DateTime(2026, 7, 29, 7)),
|
||||
],
|
||||
now: now,
|
||||
firstDay: DateTime.monday,
|
||||
);
|
||||
|
||||
expect(weeks, hasLength(12));
|
||||
expect(weeks.last.start, DateTime(2026, 10, 26));
|
||||
expect(weeks.first.start, DateTime(2026, 8, 10));
|
||||
expect(weeks.last.time, const Duration(hours: 1));
|
||||
expect(weeks.first.time, const Duration(hours: 2));
|
||||
expect(weeks.map((week) => week.count).reduce((a, b) => a + b), 2);
|
||||
});
|
||||
|
||||
test('by the calendar across a change of the clocks', () {
|
||||
// Clocks went back on 25 October 2026 in Europe.
|
||||
final weeks = weeksBack(
|
||||
const [],
|
||||
now: now,
|
||||
firstDay: DateTime.monday,
|
||||
);
|
||||
for (final week in weeks) {
|
||||
expect(week.start.weekday, DateTime.monday);
|
||||
expect(week.start.hour, 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('the year Profile shows (D60)', () {
|
||||
test('per activity, the most trained first, this calendar year alone', () {
|
||||
final year = yearSummary([
|
||||
workout(
|
||||
DateTime(2026, 3, 1, 7),
|
||||
moving: const Duration(hours: 1),
|
||||
metres: 10000,
|
||||
),
|
||||
workout(
|
||||
DateTime(2026, 10, 30, 7),
|
||||
moving: const Duration(hours: 1),
|
||||
metres: 12000,
|
||||
),
|
||||
WorkoutContent(
|
||||
activity: Activity.cycling,
|
||||
startedAt: DateTime(2026, 6, 1, 9).toUtc(),
|
||||
endedAt: DateTime(2026, 6, 1, 12).toUtc(),
|
||||
distanceMetres: 80000,
|
||||
),
|
||||
// Last year's.
|
||||
workout(DateTime(2025, 12, 31, 20), metres: 5000),
|
||||
], now: now);
|
||||
|
||||
expect(year.year, 2026);
|
||||
expect(year.activities, [
|
||||
(
|
||||
activity: Activity.cycling,
|
||||
count: 1,
|
||||
time: const Duration(hours: 3),
|
||||
metres: 80000,
|
||||
),
|
||||
(
|
||||
activity: Activity.running,
|
||||
count: 2,
|
||||
time: const Duration(hours: 2),
|
||||
metres: 22000,
|
||||
),
|
||||
]);
|
||||
});
|
||||
|
||||
test('a year without workouts lists none', () {
|
||||
expect(yearSummary(const [], now: now).activities, isEmpty);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue