workout_app: same 30/25 duration bar as the locker
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (flutter, flutter-analyze, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,flutter-analyze) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / lock-popup-safety (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (0) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (1) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (2) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (3) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (4) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (5) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (6) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (7) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (8) (push) Waiting to run
Tests / flutter test (shard ${{ matrix.shard }}) (9) (push) Waiting to run
Tests / flutter-coverage (push) Blocked by required conditions
Tests / web-coverage (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-01 17:34:14 +01:00
parent dc885b9903
commit 2d728fb791
2 changed files with 14 additions and 12 deletions

View File

@ -31,22 +31,22 @@ const int kManualWorkoutBudgetPer7Days = 2;
/// Max manual workouts allowed in any rolling 30-day window.
const int kManualWorkoutBudgetPer30Days = 10;
/// The ONE duration bar every workout type answers to, in minutes. This is
/// The ONE duration bar every activity answers to, in minutes. This is
/// the ADVERTISED number — the only one that may appear in a message the user
/// reads. Mirrors `MIN_WORKOUT_DURATION_MINUTES` in the locker's
/// `_constants.py`; the two must move together.
const int kMinWorkoutDurationMinutes = 40;
const int kMinWorkoutDurationMinutes = 30;
/// The leeway that is deliberately INVISIBLE. A session is accepted at
/// [kMinWorkoutDurationMinutes] minus this, so 35 minutes passes while every
/// string still says 40. That gap is intentional: do NOT "fix" it by
/// [kMinWorkoutDurationMinutes] minus this, so 25 minutes passes while every
/// string still says 30. That gap is intentional: do NOT "fix" it by
/// advertising the real cutoff, and never interpolate
/// [kWorkoutDurationAcceptMinutes] into a user-facing string.
const int kWorkoutDurationLeewayMinutes = 5;
/// Derived so the advertised and accept bars cannot drift apart. Comparisons
/// use this; messages use [kMinWorkoutDurationMinutes]. Compare with `>=`,
/// matching the locker, so 35.0 cannot pass one side and fail the other.
/// matching the locker, so 25.0 cannot pass one side and fail the other.
const int kWorkoutDurationAcceptMinutes =
kMinWorkoutDurationMinutes - kWorkoutDurationLeewayMinutes;
@ -185,7 +185,6 @@ class ManualWorkoutDraft {
final String equipment;
}
/// Builds the persisted `workout_data` dict for a validated draft.
///
/// Byte-for-byte equivalent of the Python `build_entry`.

View File

@ -89,10 +89,13 @@ void main() {
}
});
test('the rejection message advertises 40 and never the real cutoff', () {
final error = validateManualWorkout(_draft(10));
expect(error, isNotNull);
expect(error, contains('$kMinWorkoutDurationMinutes'));
expect(error, isNot(contains('$kWorkoutDurationAcceptMinutes')));
});
test(
'the rejection message advertises the round bar and never the real cutoff',
() {
final error = validateManualWorkout(_draft(10));
expect(error, isNotNull);
expect(error, contains('$kMinWorkoutDurationMinutes'));
expect(error, isNot(contains('$kWorkoutDurationAcceptMinutes')));
},
);
}