WT 1.1.18+4 A/B Test sales page
This commit is contained in:
@@ -92,11 +92,16 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
event.detail.state = ExercisePlanDetailState.inProgress;
|
||||
}
|
||||
|
||||
// recalculate the weight to the original planned repeats
|
||||
if (event.detail.isTest && event.detail.exercises.length == 1) {
|
||||
trainingPlanRepository.recalculateDetail(_myPlan!.trainingPlanId!, event.detail);
|
||||
}
|
||||
|
||||
exercise.trainingPlanDetailsId = _myPlan!.trainingPlanId;
|
||||
|
||||
// save Exercise
|
||||
await ExerciseApi().addExercise(exercise);
|
||||
Cache().addExercise(exercise);
|
||||
Exercise savedExercise = await ExerciseApi().addExercise(exercise);
|
||||
Cache().addExercise(savedExercise);
|
||||
|
||||
Cache().myTrainingPlan = _myPlan;
|
||||
await Cache().saveMyTrainingPlan();
|
||||
@@ -108,7 +113,6 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
}
|
||||
} else if (event is TrainingPlanSkipExercise) {
|
||||
yield TrainingPlanLoading();
|
||||
print("Skipping ${event.detail.exerciseTypeId}");
|
||||
event.detail.state = ExercisePlanDetailState.skipped;
|
||||
Cache().myTrainingPlan = _myPlan;
|
||||
await Cache().saveMyTrainingPlan();
|
||||
@@ -378,7 +382,8 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
return 0;
|
||||
}
|
||||
if (_myPlan == null || _myPlan!.details.isEmpty) {
|
||||
throw Exception("No defined Training Plan");
|
||||
// throw Exception("No defined Training Plan");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dayNames.isEmpty || dayNames.length == 1) {
|
||||
@@ -402,7 +407,7 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
}
|
||||
activeDayIndex++;
|
||||
}
|
||||
print("Active Day Index: $activeDayIndex");
|
||||
|
||||
if (activeDayIndex >= dayNames.length) {
|
||||
activeDayIndex = 0;
|
||||
this.add(TrainingPlanGoToRestart());
|
||||
@@ -481,4 +486,17 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
|
||||
return value.toStringAsFixed(0);
|
||||
}
|
||||
|
||||
bool existsAddedExerciseTypeInTree(String name) {
|
||||
bool exists = false;
|
||||
final List<WorkoutMenuTree>? listWorkoutTree = menuBloc.menuTreeRepository.sortedTree[name];
|
||||
if (listWorkoutTree != null) {
|
||||
listWorkoutTree.forEach((element) {
|
||||
if (element.exerciseType!.trainingPlanState.equalsTo(ExerciseTypeTrainingPlanState.added)) {
|
||||
exists = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
return exists;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user