Skip to content

Commit

Permalink
fix: Set initial period
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Jan 16, 2024
1 parent 9c34191 commit ff9deee
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class BoutState extends ConsumerState<BoutScreen> {
HornSound();
boutConfig = widget.boutConfig;
bout = widget.bout;
// Set the current period based on the duration:
period = (bout.duration.inSeconds ~/ boutConfig.periodDuration.inSeconds) + 1;
_r = ParticipantStateModel(bout.r);
_b = ParticipantStateModel(bout.b);
_r.injuryStopwatch.limit = boutConfig.injuryDuration;
Expand Down Expand Up @@ -183,6 +185,7 @@ class BoutState extends ConsumerState<BoutScreen> {
if (stopwatch == _boutStopwatch) {
bout = bout.copyWith(duration: event);

// If is above the time of the current period, then trigger the break
if (bout.duration.compareTo(boutConfig.periodDuration * period) >= 0) {
_boutStopwatch.stop();
if (_r.activityStopwatch != null) {
Expand Down

0 comments on commit ff9deee

Please sign in to comment.