Allow an extra workout after done today

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZ9CKZsNxtD5Jr9bYD
This commit is contained in:
Krzysztof Rudnicki 2026-11-10 16:53:37 +01:00
parent 23ad2e02b4
commit 17dac66a11
2 changed files with 13 additions and 7 deletions

View File

@ -52,7 +52,7 @@ class _WorkoutCard extends StatelessWidget {
),
const SizedBox(height: 6),
Text(
'Next: Workout $type — tomorrow',
'Next: Workout $type',
style: TextStyle(
color: colorScheme.onSurface,
fontSize: AppTextSize.body,
@ -103,7 +103,9 @@ class _WorkoutCard extends StatelessWidget {
),
),
)
else if (!doneToday)
else
// Never hidden by "done today": the PC pays for every further
// session, so an extra workout must stay one tap away.
SizedBox(
width: double.infinity,
child: ElevatedButton(

View File

@ -1,15 +1,10 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:workout_app/models/workout_plan.dart';
import 'package:workout_app/screens/home_screen.dart';
import 'package:workout_app/screens/workout_screen.dart';
import 'package:workout_app/services/storage_service.dart';
import 'package:workout_app/services/workout_sync_service.dart';
import 'package:workout_app/ui/theme.dart';
import 'package:workout_app/widgets/sync_status_card.dart';
import '../fake_secure_storage.dart';
import '_home_test_fixtures.dart';
@ -74,8 +69,17 @@ void main() {
json: '{"exercises":[]}',
),
);
// Finishing A is what makes B the next workout (saveSession alone does
// not move the A/B rotation).
await tester.runAsync(
() => StorageService.instance.setLastWorkoutType('A'),
);
await pumpHome(tester, wrapHome());
expect(find.text('Done for today!'), findsOneWidget);
// An extra session is still allowed: the PC pays for further ones.
expect(find.text('Start Workout B'), findsOneWidget);
// The run entry must not vanish either.
expect(find.byKey(const Key('home_run')), findsOneWidget);
});
testWidgets('manual-workout icon navigates to the manual form', (