WT 1.1.25+5 weight calculation fixes in the training

This commit is contained in:
bossanyit
2021-12-22 00:27:01 +01:00
parent 05cace39bf
commit f1f20d12f2
3 changed files with 91 additions and 46 deletions
+18 -1
View File
@@ -84,6 +84,23 @@ class TrainingPlanRepository {
return plan;
}
CustomerTrainingPlanDetails? getDetailById(CustomerTrainingPlan? plan, int customerTrainingPlanDetailsId) {
CustomerTrainingPlanDetails? foundDetail;
if (plan == null || plan.details.length == 0 || customerTrainingPlanDetailsId == 0) {
return foundDetail;
}
for (var detail in plan.details) {
if (detail.customerTrainingPlanDetailsId == customerTrainingPlanDetailsId) {
foundDetail = detail;
break;
}
}
return foundDetail;
}
CustomerTrainingPlanDetails createAlternativeDetail(
CustomerTrainingPlan plan, CustomerTrainingPlanDetails detail, TrainingPlanDetail elem, int exerciseTypeId) {
CustomerTrainingPlanDetails alternativeDetail = CustomerTrainingPlanDetails();
@@ -256,7 +273,7 @@ class TrainingPlanRepository {
//detail.weight = Common.calculateWeigthByChangedQuantity(detail.weight!, detail.repeats!.toDouble(), lastExercise1RM!.quantity!);
//weight = lastExercise1RM!.unitQuantity! * detail.repeats! / lastExercise1RM!.quantity!;
weight = Common.roundWeight(weight);
print("Recaluclated weight ${detail.weight} - repeat: ${detail.repeats}");
//print("Recaluclated weight ${detail.weight} - repeat: ${detail.repeats}");
//detail.repeats = Common.calculateQuantityByChangedWeight(oneRepMax, weight, detail.repeats!.toDouble());