WT 1.1.24+5 training plan fixes
This commit is contained in:
@@ -99,12 +99,13 @@ class TrainingPlanRepository {
|
||||
} else {
|
||||
detail.weight = elem.weight;
|
||||
}
|
||||
//print("Detail $detail exerciseType: ${detail.exerciseType}");
|
||||
print("Detail $detail exerciseType: ${detail.exerciseType!.exerciseTypeId}");
|
||||
|
||||
detail.state = ExercisePlanDetailState.start;
|
||||
if (detail.weight != null && detail.weight! > 0) {
|
||||
detail.base1RM = Common.calculate1RM(detail.weight!, detail.repeats!.toDouble());
|
||||
detail.baseOneRepMax = Common.calculate1RM(detail.weight!, detail.repeats!.toDouble());
|
||||
}
|
||||
detail.alternatives = Common.getExerciseTypeAlternatives(detail.exerciseTypeId);
|
||||
plan.details.add(detail);
|
||||
});
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum Antagonist { chest, biceps, triceps, back, shoulders, core, thigh, calf }
|
||||
@@ -265,24 +266,7 @@ class WorkoutTreeRepository with Logging {
|
||||
}
|
||||
|
||||
List<ExerciseType> getExerciseTypeAlternatives(int? exerciseTypeId) {
|
||||
if (exerciseTypeId == null || exerciseTypeId <= 0) {
|
||||
return [];
|
||||
}
|
||||
List<ExerciseType> list = [];
|
||||
List<ExerciseType>? exerciseTypes = Cache().getExerciseTypes();
|
||||
if (exerciseTypes != null) {
|
||||
exerciseTypes.forEach((exerciseType) {
|
||||
if (exerciseType.alternatives.isNotEmpty) {
|
||||
exerciseType.alternatives.forEach((childId) {
|
||||
if (childId == exerciseTypeId) {
|
||||
list.add(exerciseType);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
return Common.getExerciseTypeAlternatives(exerciseTypeId);
|
||||
}
|
||||
|
||||
String getAntagonistSort(String type) {
|
||||
|
||||
Reference in New Issue
Block a user