Don't use the canonical form endpoint

This was removed on the server
This commit is contained in:
Roland Geider
2021-07-24 21:55:55 +02:00
parent 51422b3053
commit de84c24e72
2 changed files with 14 additions and 17 deletions

View File

@@ -167,9 +167,9 @@ class WorkoutPlansProvider extends WgerBaseProvider with ChangeNotifier {
/// Fetches a workout plan fully, i.e. with all corresponding child attributes
Future<WorkoutPlan> fetchAndSetWorkoutPlanFull(int workoutId) async {
// Load a list of all settings so that we can search through it late
// Load a list of all settings so that we can search through it
//
// This is a bit ugly, but makes saves sending lots of requests later on
// This is a bit ugly, but saves us sending lots of requests later on
final allSettingsData = await fetch(
makeUrl(_settingsUrlPath, query: {'limit': '1000'}),
);
@@ -181,20 +181,17 @@ class WorkoutPlansProvider extends WgerBaseProvider with ChangeNotifier {
plan = await fetchAndSetPlanSparse(workoutId);
}
// Plan
final fullPlanData = await fetch(
makeUrl(_workoutPlansUrlPath, id: workoutId, objectMethod: 'canonical_representation'),
);
// Days
List<Day> days = [];
for (var dayData in fullPlanData['day_list']) {
final day = Day.fromJson(dayData['obj']);
final daysData = await fetch(makeUrl(_daysUrlPath, query: {'training': plan.id.toString()}));
for (final dayEntry in daysData['results']) {
final day = Day.fromJson(dayEntry);
// Sets
List<Set> sets = [];
for (var setData in dayData['set_list']) {
final workoutSet = Set.fromJson(setData['obj']);
final setData = await fetch(makeUrl(_setsUrlPath, query: {'exerciseday': day.id.toString()}));
for (final setEntry in setData['results']) {
final workoutSet = Set.fromJson(setEntry);
fetchComputedSettings(workoutSet); // request!

View File

@@ -112,7 +112,7 @@ packages:
name: camera
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.1+4"
version: "0.8.1+5"
camera_platform_interface:
dependency: transitive
description:
@@ -189,7 +189,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.1.0"
collection:
dependency: "direct main"
description:
@@ -292,7 +292,7 @@ packages:
name: flutter_keyboard_visibility
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.2"
version: "5.0.3"
flutter_keyboard_visibility_platform_interface:
dependency: transitive
description:
@@ -433,14 +433,14 @@ packages:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.1+4"
version: "0.8.2"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
image_picker_platform_interface:
dependency: transitive
description:
@@ -517,7 +517,7 @@ packages:
name: mockito
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.10"
version: "5.0.12"
nested:
dependency: transitive
description: