Correctly fetch the synthetic repetitions when creating a workout

This commit is contained in:
Roland Geider
2021-04-09 17:50:33 +02:00
parent 20ed6966b5
commit 0b8c8ce3de
2 changed files with 5 additions and 2 deletions

View File

@@ -311,7 +311,6 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier {
Future<Set> addSet(Set workoutSet) async {
final data = await post(workoutSet.toJson(), makeUrl(_setsUrlPath));
final set = Set.fromJson(data);
fetchComputedSettings(set);
notifyListeners();
return set;
}

View File

@@ -383,13 +383,17 @@ class _SetFormWidgetState extends State<SetFormWidget> {
for (var setting in widget._set.settings) {
setting.setId = setDb.id!;
setting.comment = '';
setting.repsText = 'temp text';
Setting settingDb = await workoutProvider.addSetting(setting);
setting.repsText = await workoutProvider.fetchSmartText(
widget._set,
setting.exerciseObj,
);
setting.id = settingDb.id;
}
// Add to workout day
workoutProvider.fetchComputedSettings(widget._set);
widget._day.sets.add(widget._set);
// Close the bottom sheet