WT1.1.0+3334 CustomerExerciseDevice fix, Badges fix

This commit is contained in:
bossanyit
2020-11-29 17:37:44 +01:00
parent b59db7c9db
commit 25c3a1d096
21 changed files with 522 additions and 549 deletions
@@ -27,6 +27,8 @@ class CustomerExerciseDeviceRepository {
found = element;
}
});
} else {
_devices = List();
}
if (found == null) {
int customerId;
@@ -36,8 +38,8 @@ class CustomerExerciseDeviceRepository {
CustomerExerciseDevice newDevice =
CustomerExerciseDevice(customerId: customerId, exerciseDeviceId: device.exerciseDeviceId, favourite: false);
newDevice.change = ModelChange.add;
await CustomerExerciseDeviceApi().addDevice(newDevice);
this._devices.add(newDevice);
CustomerExerciseDevice saved = await CustomerExerciseDeviceApi().addDevice(newDevice);
this._devices.add(saved);
Cache().setCustomerDevices(_devices);
}
}
@@ -55,9 +57,9 @@ class CustomerExerciseDeviceRepository {
}
if (found != null) {
this._devices.remove(found);
if (found.change != ModelChange.add) {
await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId);
}
//if (found.change != ModelChange.add) {
await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId);
//}
Cache().setCustomerDevices(_devices);
}
}