Skip to content

Workout.onStart ignores passed scope and triggers all scopes (duplicates/incorrect events) #1288

@moeidabbasi

Description

@moeidabbasi

Description

In Workout.onStart(Scope s, Workout w), the method ignores the provided s parameter and unconditionally triggers all scopes (ACTIVITY, STEP, and LAP).
This causes duplicate lifecycle and feedback events during workout initialization.

File / Code

File: app/src/main/org/runnerup/workout/Workout.java

if (currentStep != null) {
  currentStep.onStart(Scope.ACTIVITY, this);
  currentStep.onStart(Scope.STEP, this);
  currentStep.onStart(Scope.LAP, this);
}

Steps to Reproduce

  1. Start a workout with a specific scope (e.g., Scope.ACTIVITY).
  2. Observe that the method fires all three scopes instead of the provided one.

Expected Behavior

onStart should only trigger the scope provided as an argument.

Actual Behavior

All three scopes are called, producing duplicate feedback and events.

Impact

Duplicate lifecycle calls and inconsistent behavior in step tracking and feedback systems.

Proposed Fix

Replace the three hard-coded calls with one that honors the argument:

if (currentStep != null) {
  currentStep.onStart(s, this);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions