WT1.1.6+3 bodyType animation, bug fixes

This commit is contained in:
bossanyit
2021-02-20 16:48:01 +01:00
parent 3c5360f224
commit cf348cebb0
293 changed files with 2966 additions and 1673 deletions
+17 -3
View File
@@ -4,12 +4,13 @@ import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/customer.dart';
import 'package:aitrainer_app/model/customer_property.dart';
import 'package:aitrainer_app/model/product_test.dart';
import 'package:aitrainer_app/model/property.dart';
import 'package:aitrainer_app/model/purchase.dart';
import 'package:aitrainer_app/repository/property_repository.dart';
import 'package:aitrainer_app/service/customer_service.dart';
import 'package:aitrainer_app/service/logging.dart';
import 'package:aitrainer_app/service/product_test_service.dart';
import 'package:aitrainer_app/service/purchase.dart';
import 'package:aitrainer_app/service/purchase_service.dart';
import 'package:aitrainer_app/util/not_found_exception.dart';
class GenderItem {
@@ -115,7 +116,7 @@ class CustomerRepository with Logging {
this.setCustomerProperty(propertyName, height.toDouble());
}
setCustomerProperty(String propertyName, double value) {
setCustomerProperty(String propertyName, double value, {id = 0}) {
if (this.customer.properties[propertyName] == null) {
this.customer.properties[propertyName] = CustomerProperty(
propertyId: propertyRepository.getPropertyByName("Height").propertyId,
@@ -126,6 +127,9 @@ class CustomerRepository with Logging {
}
this.customer.properties[propertyName].dateAdd = DateTime.now();
this.customer.properties[propertyName].newData = true;
if (id > 0) {
this.customer.properties[propertyName].customerPropertyId = id;
}
}
double getWeight() {
@@ -137,7 +141,7 @@ class CustomerRepository with Logging {
}
double getCustomerPropertyValue(String propertyName) {
if (this.customer.properties[propertyName] == null) {
if (this.customer == null || this.customer.properties == null || this.customer.properties[propertyName] == null) {
return 0.0;
} else {
return this.customer.properties[propertyName].propertyValue;
@@ -196,6 +200,16 @@ class CustomerRepository with Logging {
});
}
Future<void> savePropertyByName(String name) async {
await Future.forEach(this._allProperties, (element) async {
final CustomerProperty customerProperty = element;
final Property property = propertyRepository.getPropertyByName(name);
if (property.propertyId == customerProperty.propertyId) {
await CustomerApi().updateProperty(customerProperty);
}
});
}
Future<Customer> getTraineeAsCustomer() async {
this._trainee = await CustomerApi().getTrainee(Cache().userLoggedIn.customerId);
return _trainee;
+3 -2
View File
@@ -290,7 +290,7 @@ class ExerciseRepository {
String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd);
//print(" -- $prevExerciseTypeId - $prevDate");
if (!(exerciseTypeId == prevExerciseTypeId && prevDate == exerciseDate)) {
ExerciseType exerciseType = Cache().getExercise(prevExercise.exerciseTypeId);
ExerciseType exerciseType = Cache().getExerciseTypeById(prevExercise.exerciseTypeId);
String unit = exerciseType.unitQuantityUnit != null ? exerciseType.unitQuantityUnit : prevExercise.unit;
prevExercise.summary = summary + " " + unit;
exerciseLogList.add(prevExercise);
@@ -302,7 +302,8 @@ class ExerciseRepository {
if (prevCount > 0) delimiter = ", ";
double quantity = exercise.quantity == null ? 0 : exercise.quantity;
summary += delimiter + quantity.toStringAsFixed(0);
ExerciseType exerciseType = Cache().getExercise(exercise.exerciseTypeId);
ExerciseType exerciseType = Cache().getExerciseTypeById(exercise.exerciseTypeId);
//print("exerciseType " + (exerciseType == null ? "NULL" : exerciseType.name) + " ID " + exercise.exerciseTypeId.toString());
if (exerciseType.unitQuantity == "1") {
summary += "x" + exercise.unitQuantity.toStringAsFixed(0);
}
+3 -2
View File
@@ -7,7 +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/exercise_tree_service.dart';
import 'package:aitrainer_app/service/exercisetype_service.dart';
import 'package:aitrainer_app/service/exercise_type_service.dart';
import 'package:aitrainer_app/service/logging.dart';
import 'package:flutter/material.dart';
@@ -22,7 +22,7 @@ class Antagonist {
static int backNr = 4;
static String shoulder = "Shoulders";
static int shoulderNr = 5;
static String core = "Core";
static String core = "Core & ABS";
static int coreNr = 6;
static String thigh = "Thigh";
static int thighNr = 7;
@@ -48,6 +48,7 @@ class WorkoutTreeRepository with Logging {
};
Future<void> createTree() async {
//if (Cache().getExerciseTree().length > 0 || Cache().getWorkoutMenuTree().length > 0) return;
isEnglish = AppLanguage().appLocal == Locale('en');
log("** Start creating tree on lang: " +
AppLanguage().appLocal.languageCode +