wt1.1.2d ProgressInfo+

This commit is contained in:
Bossanyi Tibor
2020-10-09 07:54:54 +02:00
parent 0cdc3a9d24
commit 35f0d0042f
66 changed files with 1615 additions and 576 deletions
+3 -1
View File
@@ -28,7 +28,9 @@ class ExercisePlanRepository {
ExercisePlan getExercisePlan() => exercisePlan;
void addDetailToPlan() {
actualPlanDetail.exercisePlanId = exercisePlan.exercisePlanId;
if ( exercisePlan != null ) {
actualPlanDetail.exercisePlanId = exercisePlan.exercisePlanId;
}
exercisePlanDetails[actualPlanDetail.exerciseTypeId] = actualPlanDetail;
Cache().addToMyExercisePlanDetails(actualPlanDetail);
}
+51 -27
View File
@@ -56,17 +56,11 @@ class ExerciseRepository {
this.exercise.dateAdd = datetimeExercise;
}
double get unitQuantity {
return this.exercise.unitQuantity;
}
double get unitQuantity => this.exercise.unitQuantity;
double get quantity {
return this.exercise.quantity;
}
double get quantity => this.exercise.quantity;
Exercise getExercise() {
return this.exercise;
}
Exercise getExercise() => this.exercise;
Future<void> addExercise() async {
final Exercise modelExercise = this.exercise;
@@ -81,13 +75,9 @@ class ExerciseRepository {
}
setCustomer(Customer customer) {
this.customer = customer;
}
setCustomer(Customer customer) => this.customer = customer;
setExerciseType( ExerciseType exerciseType) {
this.exerciseType = exerciseType;
}
setExerciseType( ExerciseType exerciseType) => this.exerciseType = exerciseType;
Future<List<Exercise>> getExercisesByCustomer( int customerId ) async {
@@ -102,17 +92,53 @@ class ExerciseRepository {
}
List<Exercise> getExerciseList() {
//if ( this.exerciseList == null || this.exerciseList.length == 0 ) {
return this.exerciseList = Cache().getExercises();
//}
//return this.exerciseList;
this.exerciseList = Cache().getExercises();
return this.exerciseList;
}
List<Exercise> getExerciseListTrainee() {
//if ( this.exerciseList == null || this.exerciseList.length == 0 ) {
return this.exerciseList = Cache().getExercisesTrainee();
//}
//return this.exerciseList;
this.exerciseList = Cache().getExercisesTrainee();
return this.exerciseList;
}
String nextMissingBaseExercise(SplayTreeMap sortedTree) {
if ( exerciseList == null ) {
exerciseList = Cache().getExercises();
}
if ( exerciseList == null ) {
return "";
}
String missingTreeName;
String foundTreeName;
bool isBreak = false;
sortedTree.forEach((key, list) {
List<WorkoutMenuTree> listByMuscle = list as List<WorkoutMenuTree>;
String treeName = key as String;
treeName = treeName.substring(3);
foundTreeName = null;
listByMuscle.forEach((exercise) {
if ( missingTreeName == null ) {
missingTreeName = treeName;
}
if ( exercise.base ) {
exerciseList.forEach((element) {
if ( element.exerciseTypeId == exercise.exerciseTypeId ) {
foundTreeName = treeName;
//print("Found " + foundTreeName + " Missing actual: " + missingTreeName);
isBreak = true;
}
});
}
});
if ( foundTreeName == null &&! isBreak ) {
missingTreeName = treeName;
isBreak = true;
}
});
return missingTreeName;
}
void getBaseExerciseFinishedPercent() {
@@ -153,7 +179,7 @@ class ExerciseRepository {
&& treeItem.exerciseType.base == true
&& exercise.exerciseTypeId == treeItem.exerciseType.exerciseTypeId
&& !checkedBaseTreeItem.contains(treeItem.parent)) {
print ("id: " + exercise.exerciseTypeId.toString());
//print ("id: " + exercise.exerciseTypeId.toString());
checkedBaseTreeItem.add(treeItem.parent);
count1RMExercises++;
}
@@ -197,8 +223,6 @@ class ExerciseRepository {
return actualExerciseType;
}
void sortByDate() {
exerciseList.sort( (b, a) => a.dateAdd.compareTo(b.dateAdd) );
}
void sortByDate() => exerciseList.sort( (a, b) => b.dateAdd.compareTo(a.dateAdd) );
}
+24 -6
View File
@@ -44,6 +44,7 @@ class WorkoutTreeRepository {
Antagonist.calf: Antagonist.calfNr
};
Future<void> createTree() async {
isEnglish = AppLanguage().appLocal == Locale('en');
@@ -145,16 +146,21 @@ class WorkoutTreeRepository {
return branch;
}
WorkoutMenuTree getParentItem(int parent) {
WorkoutMenuTree parentItem;
tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
if ( parent == workoutTree.id) {
parentItem = workoutTree;
}
});
return parentItem;
}
void sortByMuscleType() {
sortedTree = SplayTreeMap<String, List<WorkoutMenuTree>>();
tree.forEach((key, value) {
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
//print("treeitem: " + workoutTree.toJson().toString());
/*if ( workoutTree.exerciseType != null) {
print("treeItem exerciseTye " + workoutTree.exerciseType.toJson().toString());
} else {
print("treeItem exerciseType null " + workoutTree.toJson().toString());
}*/
if ( workoutTree.nameEnglish != 'One Rep Max' && workoutTree.is1RM && workoutTree.exerciseTypeId == 0) {
String treeName = _antagonist[workoutTree.nameEnglish].toString() + ". " + workoutTree.name;
sortedTree[treeName] = this.getBranchList(workoutTree.id);
@@ -163,4 +169,16 @@ class WorkoutTreeRepository {
return;
}
int getMissingTreeIdByName(String name) {
int missingId = 0;
tree.forEach((key, value) {
WorkoutMenuTree item = value as WorkoutMenuTree;
if ( item.name == name || name == item.nameEnglish ) {
missingId = item.id;
}
});
return missingId;
}
}