Skip to content

Commit

Permalink
Fix error in step index used in repeating workouts
Browse files Browse the repository at this point in the history
  • Loading branch information
jpickup committed Jan 15, 2017
1 parent 98cfc1d commit 4a39baa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/com/johnpickup/GarminScheduleGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private void generate(String inputFilename) throws IOException {
log.info("Saving workouts");
for (com.johnpickup.garmin.workout.Workout garminWorkout : converter.getGarminWorkouts()) {
String workoutFilename = generateWorkoutFilename(garminWorkout);
log.debug("Saving workout {} as {}", garminWorkout.getName(), workoutFilename);
workoutSaver.save(garminWorkout, workoutFilename);
log.info("Saved workout {} as {}", garminWorkout.getName(), workoutFilename);
}
Expand All @@ -53,6 +54,7 @@ private String generateWorkoutFilename(com.johnpickup.garmin.workout.Workout gar
String name = garminWorkout.getName();
return name.trim().replaceAll(" ","").replaceAll("/","")
.replaceAll("\\(","").replaceAll("\\)","")
.replaceAll(":","").replaceAll("\\+","") + ".fit";
.replaceAll(":","").replaceAll("\\+","-")
.replaceAll("\\*","x")+ ".fit";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ public List<WorkoutStepMesg> generateWorkoutSteps() {
List<WorkoutStepMesg> result = new ArrayList<>();

int stepCount=0;
int startIntervalIndex = 0;

for (WorkoutStep step : steps) {
List<WorkoutStepMesg> workoutMesgs = step.generateWorkoutSteps();
startIntervalIndex = workoutMesgs.get(0).getMessageIndex();
result.addAll(workoutMesgs);
stepCount += workoutMesgs.size();
}
int startIntervalIndex = result.get(0).getMessageIndex();

WorkoutStepMesg repeatStep = new WorkoutStepMesg();
repeatStep.setIntensity(Intensity.INVALID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

Expand Down

0 comments on commit 4a39baa

Please sign in to comment.