mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-05 04:57:37 +01:00
Don't use the canonical form endpoint
This was removed on the server
This commit is contained in:
@@ -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!
|
||||
|
||||
|
||||
12
pubspec.lock
12
pubspec.lock
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user