diff --git a/lib/models/workouts/base_config.dart b/lib/models/workouts/base_config.dart index 7807b443..3f78f740 100644 --- a/lib/models/workouts/base_config.dart +++ b/lib/models/workouts/base_config.dart @@ -44,9 +44,6 @@ class BaseConfig { @JsonKey(required: true) late String step; - @JsonKey(required: true, name: 'need_log_to_apply') - late bool needLogToApply; - @JsonKey(required: true, name: 'repeat') late bool repeat; @@ -61,7 +58,6 @@ class BaseConfig { required this.value, this.operation = 'r', this.step = 'abs', - this.needLogToApply = false, this.requirements = null, }); @@ -69,7 +65,6 @@ class BaseConfig { iteration = 1; operation = 'r'; step = 'abs'; - needLogToApply = false; requirements = null; repeat = false; } diff --git a/lib/models/workouts/base_config.g.dart b/lib/models/workouts/base_config.g.dart index a13e315d..564efef3 100644 --- a/lib/models/workouts/base_config.g.dart +++ b/lib/models/workouts/base_config.g.dart @@ -16,7 +16,6 @@ BaseConfig _$BaseConfigFromJson(Map json) { 'value', 'operation', 'step', - 'need_log_to_apply', 'repeat', 'requirements' ], @@ -29,7 +28,6 @@ BaseConfig _$BaseConfigFromJson(Map json) { value: stringOrIntToNum(json['value']), operation: json['operation'] as String? ?? 'r', step: json['step'] as String? ?? 'abs', - needLogToApply: json['need_log_to_apply'] as bool? ?? false, requirements: json['requirements'] ?? null, ); } @@ -40,7 +38,6 @@ Map _$BaseConfigToJson(BaseConfig instance) => _routines = []; List _weightUnits = []; @@ -79,7 +79,7 @@ class RoutinesProvider with ChangeNotifier { List? weightUnits, List? repetitionUnits, }) { - _exercises = exercises; + _exerciseProvider = exercises; _routines = entries; _weightUnits = weightUnits ?? []; _repetitionUnits = repetitionUnits ?? []; @@ -93,6 +93,10 @@ class RoutinesProvider with ChangeNotifier { return [..._weightUnits]; } + set weightUnits(List weightUnits) { + _weightUnits = weightUnits; + } + /// Clears all lists void clear() { _currentRoutine = null; @@ -112,6 +116,10 @@ class RoutinesProvider with ChangeNotifier { return [..._repetitionUnits]; } + set repetitionUnits(List repetitionUnits) { + _repetitionUnits = repetitionUnits; + } + RepetitionUnit findRepetitionUnitById(int id) => _repetitionUnits.firstWhere((element) => element.id == id); @@ -196,7 +204,7 @@ class RoutinesProvider with ChangeNotifier { for (final entry in entries) { for (final slot in entry.slots) { for (final setConfig in slot.setConfigs) { - setConfig.exercise = (await _exercises.fetchAndSetExercise(setConfig.exerciseId))!; + setConfig.exercise = (await _exerciseProvider.fetchAndSetExercise(setConfig.exerciseId))!; setConfig.repetitionsUnit = _repetitionUnits.firstWhere( (e) => e.id == setConfig.repetitionsUnitId, @@ -305,7 +313,8 @@ class RoutinesProvider with ChangeNotifier { for (final day in routine.days) { for (final slot in day.slots) { for (final slotEntry in slot.entries) { - slotEntry.exerciseObj = (await _exercises.fetchAndSetExercise(slotEntry.exerciseId))!; + slotEntry.exerciseObj = + (await _exerciseProvider.fetchAndSetExercise(slotEntry.exerciseId))!; slotEntry.repetitionUnitObj = _repetitionUnits.firstWhere( (e) => e.id == slotEntry.repetitionUnitId, ); @@ -327,7 +336,7 @@ class RoutinesProvider with ChangeNotifier { for (final log in session.logs) { log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId); log.repetitionUnit = _repetitionUnits.firstWhere((e) => e.id == log.repetitionsUnitId); - log.exerciseBase = (await _exercises.fetchAndSetExercise(log.exerciseId))!; + log.exerciseBase = (await _exerciseProvider.fetchAndSetExercise(log.exerciseId))!; } } @@ -535,7 +544,7 @@ class RoutinesProvider with ChangeNotifier { baseProvider.makeUrl(_slotEntriesUrlPath), ); final newEntry = SlotEntry.fromJson(data); - newEntry.exerciseObj = (await _exercises.fetchAndSetExercise(newEntry.exerciseId))!; + newEntry.exerciseObj = (await _exerciseProvider.fetchAndSetExercise(newEntry.exerciseId))!; for (final routine in _routines) { for (final day in routine.days) { @@ -696,7 +705,7 @@ class RoutinesProvider with ChangeNotifier { newLog.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId); newLog.repetitionUnit = _repetitionUnits.firstWhere((e) => e.id == log.weightUnitId); - newLog.exerciseBase = (await _exercises.fetchAndSetExercise(log.exerciseId))!; + newLog.exerciseBase = (await _exerciseProvider.fetchAndSetExercise(log.exerciseId))!; final plan = findById(newLog.routineId); final session = plan.sessions.firstWhere((element) => element.session.id == newLog.sessionId); diff --git a/test/fixtures/routines/routine_current_iteration_display.json b/test/fixtures/routines/routine_current_iteration_display.json new file mode 100644 index 00000000..3c4c2340 --- /dev/null +++ b/test/fixtures/routines/routine_current_iteration_display.json @@ -0,0 +1,145 @@ +[ + { + "iteration": 4, + "date": "2025-01-27", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 4, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-28", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-29", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 4, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 23 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-30", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-31", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-01", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-02", + "label": null, + "day": null, + "slots": [] + } +] \ No newline at end of file diff --git a/test/fixtures/routines/routine_current_iteration_gym.json b/test/fixtures/routines/routine_current_iteration_gym.json new file mode 100644 index 00000000..12264e83 --- /dev/null +++ b/test/fixtures/routines/routine_current_iteration_gym.json @@ -0,0 +1,277 @@ +[ + { + "iteration": 4, + "date": "2025-01-27", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-28", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-29", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-30", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-31", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-01", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-02", + "label": null, + "day": null, + "slots": [] + } +] \ No newline at end of file diff --git a/test/fixtures/routines/routine_date_sequence_display.json b/test/fixtures/routines/routine_date_sequence_display.json new file mode 100644 index 00000000..faf59fa8 --- /dev/null +++ b/test/fixtures/routines/routine_date_sequence_display.json @@ -0,0 +1,696 @@ +[ + { + "iteration": 1, + "date": "2025-01-05", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 4, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 1, + "date": "2025-01-06", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-07", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 4, + "max_sets": null, + "weight": "20.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 20-22 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 1, + "date": "2025-01-08", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-09", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-10", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-11", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-12", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-13", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 4, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 2, + "date": "2025-01-14", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-15", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 4, + "max_sets": null, + "weight": "21.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 21-22 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 2, + "date": "2025-01-16", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-17", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-18", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-19", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-20", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 4, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 3, + "date": "2025-01-21", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-22", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 4, + "max_sets": null, + "weight": "22.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 22 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 3, + "date": "2025-01-23", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-24", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-25", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-26", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-27", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 4, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-28", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-29", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 4, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 23 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-30", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-31", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-01", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-02", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 5, + "date": "2025-02-03", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 4, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 5, + "date": "2025-02-04", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 5, + "date": "2025-02-05", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 4, + "max_sets": null, + "weight": "24.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "4 Sätze, 10 × 24 kg 120s rest", + "comment": "" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/fixtures/routines/routine_date_sequence_gym.json b/test/fixtures/routines/routine_date_sequence_gym.json new file mode 100644 index 00000000..a5557aaa --- /dev/null +++ b/test/fixtures/routines/routine_date_sequence_gym.json @@ -0,0 +1,1356 @@ +[ + { + "iteration": 1, + "date": "2025-01-05", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 1, + "date": "2025-01-06", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-07", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "20.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 20-22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "20.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 20-22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "20.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 20-22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "20.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 20-22 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 1, + "date": "2025-01-08", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-09", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-10", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-11", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 1, + "date": "2025-01-12", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-13", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 2, + "date": "2025-01-14", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-15", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "21.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 21-22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "21.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 21-22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "21.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 21-22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "21.00", + "max_weight": "22.00", + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 21-22 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 2, + "date": "2025-01-16", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-17", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-18", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 2, + "date": "2025-01-19", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-20", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 3, + "date": "2025-01-21", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-22", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "22.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "22.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "22.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 22 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "22.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 22 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 3, + "date": "2025-01-23", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-24", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-25", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 3, + "date": "2025-01-26", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-27", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-28", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-29", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "23.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 23 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 4, + "date": "2025-01-30", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-01-31", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-01", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 4, + "date": "2025-02-02", + "label": null, + "day": null, + "slots": [] + }, + { + "iteration": 5, + "date": "2025-02-03", + "label": null, + "day": { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 76 + ], + "sets": [ + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 2, + "exercise": 76, + "sets": 1, + "max_sets": null, + "weight": "80.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 80 kg 120s rest", + "comment": "" + } + ] + } + ] + }, + { + "iteration": 5, + "date": "2025-02-04", + "label": null, + "day": { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [] + }, + { + "iteration": 5, + "date": "2025-02-05", + "label": null, + "day": { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null + }, + "slots": [ + { + "comment": "", + "is_superset": false, + "exercises": [ + 92 + ], + "sets": [ + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "24.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 24 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "24.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 24 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "24.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 24 kg 120s rest", + "comment": "" + }, + { + "slot_entry_id": 3, + "exercise": 92, + "sets": 1, + "max_sets": null, + "weight": "24.00", + "max_weight": null, + "weight_unit": 1, + "weight_rounding": null, + "repetitions": "10.00", + "max_repetitions": null, + "repetitions_unit": 1, + "repetitions_rounding": null, + "rir": null, + "max_rir": null, + "rpe": null, + "rest": "120.00", + "max_rest": null, + "type": "normal", + "text_repr": "10 × 24 kg 120s rest", + "comment": "" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/fixtures/routines/routine_logs.json b/test/fixtures/routines/routine_logs.json new file mode 100644 index 00000000..cca04829 --- /dev/null +++ b/test/fixtures/routines/routine_logs.json @@ -0,0 +1,284 @@ +[ + { + "session": { + "id": 5, + "routine": 2, + "day": null, + "date": "2025-01-06", + "notes": null, + "impression": "2", + "time_start": "20:28:49", + "time_end": "23:35:53" + }, + "logs": [ + { + "id": 4, + "date": "2025-01-06T00:00:00+01:00", + "session": 5, + "routine": 2, + "iteration": 1, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "11.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "78.00", + "weight_target": "80.00", + "rir": "4", + "rir_target": null, + "rest": 150, + "rest_target": 120 + }, + { + "id": 2, + "date": "2025-01-06T00:00:00+01:00", + "session": 5, + "routine": 2, + "iteration": 1, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "12.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "77.00", + "weight_target": "80.00", + "rir": "2", + "rir_target": null, + "rest": 159, + "rest_target": 120 + }, + { + "id": 1, + "date": "2025-01-06T00:00:00+01:00", + "session": 5, + "routine": 2, + "iteration": 1, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "12.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "78.00", + "weight_target": "80.00", + "rir": "2.5", + "rir_target": null, + "rest": 143, + "rest_target": 120 + }, + { + "id": 3, + "date": "2025-01-06T00:00:00+01:00", + "session": 5, + "routine": 2, + "iteration": 1, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "12.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "83.00", + "weight_target": "80.00", + "rir": "0.5", + "rir_target": null, + "rest": 160, + "rest_target": 120 + } + ] + }, + { + "session": { + "id": 6, + "routine": 2, + "day": null, + "date": "2025-01-08", + "notes": null, + "impression": "2", + "time_start": "12:55:54", + "time_end": "14:25:31" + }, + "logs": [ + { + "id": 7, + "date": "2025-01-08T00:00:00+01:00", + "session": 6, + "routine": 2, + "iteration": 1, + "slot_entry": 3, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "10.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "80.00", + "weight_target": "80.00", + "rir": "3", + "rir_target": null, + "rest": 131, + "rest_target": 120 + }, + { + "id": 8, + "date": "2025-01-08T00:00:00+01:00", + "session": 6, + "routine": 2, + "iteration": 1, + "slot_entry": 3, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "11.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "83.00", + "weight_target": "80.00", + "rir": "3", + "rir_target": null, + "rest": 128, + "rest_target": 120 + }, + { + "id": 5, + "date": "2025-01-08T00:00:00+01:00", + "session": 6, + "routine": 2, + "iteration": 1, + "slot_entry": 3, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "11.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "90.00", + "weight_target": "80.00", + "rir": "0.5", + "rir_target": null, + "rest": 121, + "rest_target": 120 + }, + { + "id": 6, + "date": "2025-01-08T00:00:00+01:00", + "session": 6, + "routine": 2, + "iteration": 1, + "slot_entry": 3, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "12.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "77.00", + "weight_target": "80.00", + "rir": "1.5", + "rir_target": null, + "rest": 129, + "rest_target": 120 + } + ] + }, + { + "session": { + "id": 7, + "routine": 2, + "day": null, + "date": "2025-01-13", + "notes": null, + "impression": "2", + "time_start": "18:48:45", + "time_end": "20:20:52" + }, + "logs": [ + { + "id": 11, + "date": "2025-01-13T00:00:00+01:00", + "session": 7, + "routine": 2, + "iteration": 2, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "9.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "84.00", + "weight_target": "80.00", + "rir": "0", + "rir_target": null, + "rest": 128, + "rest_target": 120 + }, + { + "id": 10, + "date": "2025-01-13T00:00:00+01:00", + "session": 7, + "routine": 2, + "iteration": 2, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "10.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "84.00", + "weight_target": "80.00", + "rir": "4", + "rir_target": null, + "rest": 149, + "rest_target": 120 + }, + { + "id": 12, + "date": "2025-01-13T00:00:00+01:00", + "session": 7, + "routine": 2, + "iteration": 2, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "10.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "89.00", + "weight_target": "80.00", + "rir": "1.5", + "rir_target": null, + "rest": 120, + "rest_target": 120 + }, + { + "id": 9, + "date": "2025-01-13T00:00:00+01:00", + "session": 7, + "routine": 2, + "iteration": 2, + "slot_entry": 2, + "next_log": null, + "exercise": 76, + "repetitions_unit": 1, + "repetitions": "12.00", + "repetitions_target": "10.00", + "weight_unit": 1, + "weight": "90.00", + "weight_target": "80.00", + "rir": "2.5", + "rir_target": null, + "rest": 119, + "rest_target": 120 + } + ] + } +] \ No newline at end of file diff --git a/test/fixtures/routines/routine_structure.json b/test/fixtures/routines/routine_structure.json new file mode 100644 index 00000000..aadf28cd --- /dev/null +++ b/test/fixtures/routines/routine_structure.json @@ -0,0 +1,266 @@ +{ + "id": 101, + "name": "Test 123", + "description": "", + "created": "2025-02-02T17:52:36.245680+01:00", + "start": "2025-01-06", + "end": "2025-03-28", + "fit_in_week": true, + "days": [ + { + "id": 8, + "routine": 2, + "order": 1, + "name": "Leg day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null, + "slots": [ + { + "id": 2, + "day": 8, + "order": 1, + "comment": "", + "entries": [ + { + "id": 2, + "slot": 2, + "exercise": 76, + "order": 1, + "comment": "", + "type": "normal", + "class_name": null, + "config": null, + "repetition_unit": 1, + "repetition_rounding": null, + "repetitions_configs": [ + { + "id": 2, + "slot_entry": 2, + "iteration": 1, + "value": "10.00", + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_repetitions_configs": [], + "weight_unit": 1, + "weight_rounding": null, + "weight_configs": [ + { + "id": 1, + "slot_entry": 2, + "iteration": 1, + "value": "80.00", + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_weight_configs": [], + "set_nr_configs": [ + { + "id": 2, + "slot_entry": 2, + "iteration": 1, + "value": 4, + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_set_nr_configs": [], + "rir_configs": [], + "max_rir_configs": [], + "rest_configs": [ + { + "id": 2, + "slot_entry": 2, + "iteration": 1, + "value": 120, + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_rest_configs": [] + } + ], + "config": null + } + ] + }, + { + "id": 9, + "routine": 2, + "order": 2, + "name": "", + "description": "", + "is_rest": true, + "need_logs_to_advance": false, + "type": "custom", + "config": null, + "slots": [] + }, + { + "id": 10, + "routine": 2, + "order": 3, + "name": "Arms day", + "description": "Leg day", + "is_rest": false, + "need_logs_to_advance": false, + "type": "custom", + "config": null, + "slots": [ + { + "id": 3, + "day": 10, + "order": 1, + "comment": "", + "entries": [ + { + "id": 3, + "slot": 3, + "exercise": 92, + "order": 1, + "comment": "", + "type": "normal", + "class_name": null, + "config": null, + "repetition_unit": 1, + "repetition_rounding": null, + "repetitions_configs": [ + { + "id": 3, + "slot_entry": 3, + "iteration": 1, + "value": "10.00", + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_repetitions_configs": [], + "weight_unit": 1, + "weight_rounding": null, + "weight_configs": [ + { + "id": 2, + "slot_entry": 3, + "iteration": 1, + "value": "20.00", + "operation": "r", + "step": "na", + "repeat": false, + "requirements": { + "rules": [] + } + }, + { + "id": 7, + "slot_entry": 3, + "iteration": 2, + "value": "1.00", + "operation": "+", + "step": "abs", + "repeat": true, + "requirements": { + "rules": [] + } + }, + { + "id": 8, + "slot_entry": 3, + "iteration": 8, + "value": "20.00", + "operation": "r", + "step": "na", + "repeat": false, + "requirements": { + "rules": [] + } + } + ], + "max_weight_configs": [ + { + "id": 1, + "slot_entry": 3, + "iteration": 1, + "value": "22.00", + "operation": "r", + "step": "na", + "repeat": false, + "requirements": { + "rules": [] + } + }, + { + "id": 2, + "slot_entry": 3, + "iteration": 2, + "value": "1.00", + "operation": "+", + "step": "abs", + "repeat": true, + "requirements": { + "rules": [] + } + }, + { + "id": 3, + "slot_entry": 3, + "iteration": 8, + "value": "22.00", + "operation": "r", + "step": "na", + "repeat": false, + "requirements": { + "rules": [] + } + } + ], + "set_nr_configs": [ + { + "id": 3, + "slot_entry": 3, + "iteration": 1, + "value": 4, + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_set_nr_configs": [], + "rir_configs": [], + "max_rir_configs": [], + "rest_configs": [ + { + "id": 3, + "slot_entry": 3, + "iteration": 1, + "value": 120, + "operation": "r", + "step": "abs", + "repeat": false, + "requirements": null + } + ], + "max_rest_configs": [] + } + ], + "config": null + } + ] + } + ] +} \ No newline at end of file diff --git a/test/workout/day_form_test.mocks.dart b/test/workout/day_form_test.mocks.dart index 1e941e3d..0a1cc72c 100644 --- a/test/workout/day_form_test.mocks.dart +++ b/test/workout/day_form_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/repetition_unit_form_widget_test.mocks.dart b/test/workout/repetition_unit_form_widget_test.mocks.dart index b7568d06..767865e4 100644 --- a/test/workout/repetition_unit_form_widget_test.mocks.dart +++ b/test/workout/repetition_unit_form_widget_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/routine_edit_screen_test.mocks.dart b/test/workout/routine_edit_screen_test.mocks.dart index dd67580c..1e9653af 100644 --- a/test/workout/routine_edit_screen_test.mocks.dart +++ b/test/workout/routine_edit_screen_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/routine_edit_test.mocks.dart b/test/workout/routine_edit_test.mocks.dart index dff0ee64..02bf8562 100644 --- a/test/workout/routine_edit_test.mocks.dart +++ b/test/workout/routine_edit_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/routine_form_test.mocks.dart b/test/workout/routine_form_test.mocks.dart index 96af3739..0d30517b 100644 --- a/test/workout/routine_form_test.mocks.dart +++ b/test/workout/routine_form_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/routine_logs_screen_test.mocks.dart b/test/workout/routine_logs_screen_test.mocks.dart index 51e60920..83c001fa 100644 --- a/test/workout/routine_logs_screen_test.mocks.dart +++ b/test/workout/routine_logs_screen_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/routines_provider_test.dart b/test/workout/routines_provider_test.dart index 8d473868..edd34f9c 100644 --- a/test/workout/routines_provider_test.dart +++ b/test/workout/routines_provider_test.dart @@ -33,10 +33,12 @@ import 'package:wger/providers/base_provider.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/routines.dart'; +import '../../test_data/exercises.dart'; +import '../../test_data/routines.dart'; import '../fixtures/fixture_reader.dart'; import 'routines_provider_test.mocks.dart'; -@GenerateMocks([WgerBaseProvider]) +@GenerateMocks([WgerBaseProvider, ExercisesProvider]) void main() { final mockBaseProvider = MockWgerBaseProvider(); @@ -59,7 +61,7 @@ void main() { 'description': 'Test workout abcd', 'start': '2021-12-20', 'end': '2022-06-06', - 'fit_in_week': false + 'fit_in_week': false, }), ); @@ -163,5 +165,78 @@ void main() { expect(true, DateTime.parse(prefsJson['date']).isBefore(DateTime.now())); expect(true, DateTime.parse(prefsJson['expiresIn']).isAfter(DateTime.now())); }); + + test('Smoke test fetchAndSetRoutineFull', () async { + //Arrange + final structureUri = Uri.https('localhost', 'api/v2/routine/101/structure/'); + when(mockBaseProvider.makeUrl('routine', objectMethod: 'structure', id: 101)) + .thenReturn(structureUri); + when(mockBaseProvider.fetch(structureUri)).thenAnswer((_) async => Future.value( + jsonDecode(fixture('routines/routine_structure.json')), + )); + + final dateSequenceDisplayUri = + Uri.https('localhost', 'api/v2/routine/101/date-sequence-display/'); + when(mockBaseProvider.makeUrl('routine', objectMethod: 'date-sequence-display', id: 101)) + .thenReturn(dateSequenceDisplayUri); + when(mockBaseProvider.fetch(dateSequenceDisplayUri)).thenAnswer((_) async => Future.value( + jsonDecode(fixture('routines/routine_date_sequence_display.json')), + )); + + final dateSequenceGymUri = Uri.https('localhost', 'api/v2/routine/101/date-sequence-gym/'); + when(mockBaseProvider.makeUrl('routine', objectMethod: 'date-sequence-gym', id: 101)) + .thenReturn(dateSequenceGymUri); + when(mockBaseProvider.fetch(dateSequenceGymUri)).thenAnswer((_) async => Future.value( + jsonDecode(fixture('routines/routine_date_sequence_gym.json')), + )); + + final currentIterationDisplayUri = + Uri.https('localhost', 'api/v2/routine/101/current-iteration-display/'); + when(mockBaseProvider.makeUrl('routine', objectMethod: 'current-iteration-display', id: 101)) + .thenReturn(currentIterationDisplayUri); + when(mockBaseProvider.fetch(currentIterationDisplayUri)).thenAnswer((_) async => Future.value( + jsonDecode(fixture('routines/routine_date_sequence_gym.json')), + )); + + final currentIterationGymUri = + Uri.https('localhost', 'api/v2/routine/101/current-iteration-gym/'); + when(mockBaseProvider.makeUrl('routine', objectMethod: 'current-iteration-gym', id: 101)) + .thenReturn(currentIterationGymUri); + when(mockBaseProvider.fetch(currentIterationGymUri)).thenAnswer((_) async => Future.value( + jsonDecode(fixture('routines/routine_current_iteration_gym.json')), + )); + + final logsUri = Uri.https('localhost', 'api/v2/routine/101/logs/'); + when(mockBaseProvider.makeUrl('routine', objectMethod: 'logs', id: 101)).thenReturn(logsUri); + when(mockBaseProvider.fetch(logsUri)).thenAnswer((_) async => Future.value( + jsonDecode(fixture('routines/routine_logs.json')), + )); + + final mockExercisesProvider = MockExercisesProvider(); + when(mockExercisesProvider.fetchAndSetExercise(76)).thenAnswer( + (_) async => Future.value(testBenchPress), + ); + when(mockExercisesProvider.fetchAndSetExercise(92)).thenAnswer( + (_) async => Future.value(testCrunches), + ); + + final provider = RoutinesProvider(mockBaseProvider, mockExercisesProvider, []); + provider.repetitionUnits = testRepetitionUnits; + provider.weightUnits = testWeightUnits; + + // Act + final result = await provider.fetchAndSetRoutineFull(101); + + // Assert + expect(result, isA()); + expect(result.id, 101); + expect(result.sessions.length, 3); + expect(result.days.length, 3); + expect(result.logs.length, 12); + expect(result.dayDataCurrentIteration.length, 32); + expect(result.dayDataCurrentIterationGym.length, 7); + expect(result.dayData.length, 32); + expect(result.dayDataGym.length, 32); + }); }); } diff --git a/test/workout/routines_provider_test.mocks.dart b/test/workout/routines_provider_test.mocks.dart index 9c26d49b..b94e0c8c 100644 --- a/test/workout/routines_provider_test.mocks.dart +++ b/test/workout/routines_provider_test.mocks.dart @@ -3,12 +3,20 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i11; +import 'dart:ui' as _i13; import 'package:http/http.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; +import 'package:wger/database/exercises/exercise_database.dart' as _i5; +import 'package:wger/models/exercises/category.dart' as _i7; +import 'package:wger/models/exercises/equipment.dart' as _i8; +import 'package:wger/models/exercises/exercise.dart' as _i6; +import 'package:wger/models/exercises/language.dart' as _i10; +import 'package:wger/models/exercises/muscle.dart' as _i9; import 'package:wger/providers/auth.dart' as _i2; import 'package:wger/providers/base_provider.dart' as _i4; +import 'package:wger/providers/exercises.dart' as _i12; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -40,6 +48,37 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } +class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider { + _FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase { + _FakeExerciseDatabase_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise { + _FakeExercise_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); +} + +class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory { + _FakeExerciseCategory_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeEquipment_8 extends _i1.SmartFake implements _i8.Equipment { + _FakeEquipment_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); +} + +class _FakeMuscle_9 extends _i1.SmartFake implements _i9.Muscle { + _FakeMuscle_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); +} + +class _FakeLanguage_10 extends _i1.SmartFake implements _i10.Language { + _FakeLanguage_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); +} + /// A class which mocks [WgerBaseProvider]. /// /// See the documentation for Mockito's code generation for more information. @@ -104,46 +143,400 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ) as Uri); @override - _i5.Future fetch(Uri? uri) => (super.noSuchMethod( + _i11.Future fetch(Uri? uri) => (super.noSuchMethod( Invocation.method(#fetch, [uri]), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i11.Future.value(), + ) as _i11.Future); @override - _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( + _i11.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method(#fetchPaginated, [uri]), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i11.Future>.value([]), + ) as _i11.Future>); @override - _i5.Future> post(Map? data, Uri? uri) => + _i11.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( Invocation.method(#post, [data, uri]), - returnValue: _i5.Future>.value( + returnValue: _i11.Future>.value( {}, ), - ) as _i5.Future>); + ) as _i11.Future>); @override - _i5.Future> patch( + _i11.Future> patch( Map? data, Uri? uri, ) => (super.noSuchMethod( Invocation.method(#patch, [data, uri]), - returnValue: _i5.Future>.value( + returnValue: _i11.Future>.value( {}, ), - ) as _i5.Future>); + ) as _i11.Future>); @override - _i5.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( + _i11.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( Invocation.method(#deleteRequest, [url, id]), - returnValue: _i5.Future<_i3.Response>.value( + returnValue: _i11.Future<_i3.Response>.value( _FakeResponse_3( this, Invocation.method(#deleteRequest, [url, id]), ), ), - ) as _i5.Future<_i3.Response>); + ) as _i11.Future<_i3.Response>); +} + +/// A class which mocks [ExercisesProvider]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { + MockExercisesProvider() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.WgerBaseProvider get baseProvider => (super.noSuchMethod( + Invocation.getter(#baseProvider), + returnValue: _FakeWgerBaseProvider_4( + this, + Invocation.getter(#baseProvider), + ), + ) as _i4.WgerBaseProvider); + + @override + _i5.ExerciseDatabase get database => (super.noSuchMethod( + Invocation.getter(#database), + returnValue: _FakeExerciseDatabase_5( + this, + Invocation.getter(#database), + ), + ) as _i5.ExerciseDatabase); + + @override + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter(#database, _database), + returnValueForMissingStub: null, + ); + + @override + List<_i6.Exercise> get exercises => (super.noSuchMethod( + Invocation.getter(#exercises), + returnValue: <_i6.Exercise>[], + ) as List<_i6.Exercise>); + + @override + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter(#exercises, _exercises), + returnValueForMissingStub: null, + ); + + @override + List<_i6.Exercise> get filteredExercises => (super.noSuchMethod( + Invocation.getter(#filteredExercises), + returnValue: <_i6.Exercise>[], + ) as List<_i6.Exercise>); + + @override + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( + Invocation.setter(#filteredExercises, newFilteredExercises), + returnValueForMissingStub: null, + ); + + @override + Map> get exerciseBasesByVariation => (super.noSuchMethod( + Invocation.getter(#exerciseBasesByVariation), + returnValue: >{}, + ) as Map>); + + @override + List<_i7.ExerciseCategory> get categories => (super.noSuchMethod( + Invocation.getter(#categories), + returnValue: <_i7.ExerciseCategory>[], + ) as List<_i7.ExerciseCategory>); + + @override + List<_i9.Muscle> get muscles => (super.noSuchMethod( + Invocation.getter(#muscles), + returnValue: <_i9.Muscle>[], + ) as List<_i9.Muscle>); + + @override + List<_i8.Equipment> get equipment => (super.noSuchMethod( + Invocation.getter(#equipment), + returnValue: <_i8.Equipment>[], + ) as List<_i8.Equipment>); + + @override + List<_i10.Language> get languages => (super.noSuchMethod( + Invocation.getter(#languages), + returnValue: <_i10.Language>[], + ) as List<_i10.Language>); + + @override + set languages(List<_i10.Language>? languages) => super.noSuchMethod( + Invocation.setter(#languages, languages), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + + @override + _i11.Future setFilters(_i12.Filters? newFilters) => (super.noSuchMethod( + Invocation.method(#setFilters, [newFilters]), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + void initFilters() => super.noSuchMethod( + Invocation.method(#initFilters, []), + returnValueForMissingStub: null, + ); + + @override + _i11.Future findByFilters() => (super.noSuchMethod( + Invocation.method(#findByFilters, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + void clear() => super.noSuchMethod( + Invocation.method(#clear, []), + returnValueForMissingStub: null, + ); + + @override + _i6.Exercise findExerciseById(int? id) => (super.noSuchMethod( + Invocation.method(#findExerciseById, [id]), + returnValue: _FakeExercise_6( + this, + Invocation.method(#findExerciseById, [id]), + ), + ) as _i6.Exercise); + + @override + List<_i6.Exercise> findExercisesByVariationId( + int? id, { + int? exerciseBaseIdToExclude, + }) => + (super.noSuchMethod( + Invocation.method( + #findExercisesByVariationId, + [id], + {#exerciseBaseIdToExclude: exerciseBaseIdToExclude}, + ), + returnValue: <_i6.Exercise>[], + ) as List<_i6.Exercise>); + + @override + _i7.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( + Invocation.method(#findCategoryById, [id]), + returnValue: _FakeExerciseCategory_7( + this, + Invocation.method(#findCategoryById, [id]), + ), + ) as _i7.ExerciseCategory); + + @override + _i8.Equipment findEquipmentById(int? id) => (super.noSuchMethod( + Invocation.method(#findEquipmentById, [id]), + returnValue: _FakeEquipment_8( + this, + Invocation.method(#findEquipmentById, [id]), + ), + ) as _i8.Equipment); + + @override + _i9.Muscle findMuscleById(int? id) => (super.noSuchMethod( + Invocation.method(#findMuscleById, [id]), + returnValue: _FakeMuscle_9( + this, + Invocation.method(#findMuscleById, [id]), + ), + ) as _i9.Muscle); + + @override + _i10.Language findLanguageById(int? id) => (super.noSuchMethod( + Invocation.method(#findLanguageById, [id]), + returnValue: _FakeLanguage_10( + this, + Invocation.method(#findLanguageById, [id]), + ), + ) as _i10.Language); + + @override + _i11.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( + Invocation.method(#fetchAndSetCategoriesFromApi, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( + Invocation.method(#fetchAndSetMusclesFromApi, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( + Invocation.method(#fetchAndSetEquipmentsFromApi, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( + Invocation.method(#fetchAndSetLanguagesFromApi, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future<_i6.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( + Invocation.method(#fetchAndSetExercise, [exerciseId]), + returnValue: _i11.Future<_i6.Exercise?>.value(), + ) as _i11.Future<_i6.Exercise?>); + + @override + _i11.Future<_i6.Exercise> handleUpdateExerciseFromApi( + _i5.ExerciseDatabase? database, + int? exerciseId, + ) => + (super.noSuchMethod( + Invocation.method(#handleUpdateExerciseFromApi, [ + database, + exerciseId, + ]), + returnValue: _i11.Future<_i6.Exercise>.value( + _FakeExercise_6( + this, + Invocation.method(#handleUpdateExerciseFromApi, [ + database, + exerciseId, + ]), + ), + ), + ) as _i11.Future<_i6.Exercise>); + + @override + _i11.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( + Invocation.method(#initCacheTimesLocalPrefs, [], { + #forceInit: forceInit, + }), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future clearAllCachesAndPrefs() => (super.noSuchMethod( + Invocation.method(#clearAllCachesAndPrefs, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetInitialData() => (super.noSuchMethod( + Invocation.method(#fetchAndSetInitialData, []), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future setExercisesFromDatabase( + _i5.ExerciseDatabase? database, { + bool? forceDeleteCache = false, + }) => + (super.noSuchMethod( + Invocation.method( + #setExercisesFromDatabase, + [database], + {#forceDeleteCache: forceDeleteCache}, + ), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future updateExerciseCache(_i5.ExerciseDatabase? database) => (super.noSuchMethod( + Invocation.method(#updateExerciseCache, [database]), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetMuscles(_i5.ExerciseDatabase? database) => (super.noSuchMethod( + Invocation.method(#fetchAndSetMuscles, [database]), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetCategories(_i5.ExerciseDatabase? database) => (super.noSuchMethod( + Invocation.method(#fetchAndSetCategories, [database]), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetLanguages(_i5.ExerciseDatabase? database) => (super.noSuchMethod( + Invocation.method(#fetchAndSetLanguages, [database]), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future fetchAndSetEquipments(_i5.ExerciseDatabase? database) => (super.noSuchMethod( + Invocation.method(#fetchAndSetEquipments, [database]), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + + @override + _i11.Future> searchExercise( + String? name, { + String? languageCode = 'en', + bool? searchEnglish = false, + }) => + (super.noSuchMethod( + Invocation.method( + #searchExercise, + [name], + {#languageCode: languageCode, #searchEnglish: searchEnglish}, + ), + returnValue: _i11.Future>.value( + <_i6.Exercise>[], + ), + ) as _i11.Future>); + + @override + void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + Invocation.method(#removeListener, [listener]), + returnValueForMissingStub: null, + ); + + @override + void dispose() => super.noSuchMethod( + Invocation.method(#dispose, []), + returnValueForMissingStub: null, + ); + + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null, + ); } diff --git a/test/workout/slot_entry_form_test.mocks.dart b/test/workout/slot_entry_form_test.mocks.dart index c104eed1..85a9cd42 100644 --- a/test/workout/slot_entry_form_test.mocks.dart +++ b/test/workout/slot_entry_form_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test/workout/weight_unit_form_widget_test.mocks.dart b/test/workout/weight_unit_form_widget_test.mocks.dart index 386cdd96..dc95f310 100644 --- a/test/workout/weight_unit_form_widget_test.mocks.dart +++ b/test/workout/weight_unit_form_widget_test.mocks.dart @@ -107,6 +107,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); + @override + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter(#weightUnits, weightUnits), + returnValueForMissingStub: null, + ); + @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -122,6 +128,12 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter(#repetitionUnits, repetitionUnits), + returnValueForMissingStub: null, + ); + @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), diff --git a/test_data/exercises.dart b/test_data/exercises.dart index 63faa2d3..ab23e265 100644 --- a/test_data/exercises.dart +++ b/test_data/exercises.dart @@ -50,7 +50,7 @@ const tEquipment3 = Equipment(id: 3, name: 'Bench'); const tEquipment4 = Equipment(id: 10, name: 'Gym mat'); const testEquipment = [tEquipment1, tEquipment2, tEquipment3]; -final benchPress = Exercise( +final testBenchPress = Exercise( id: 1, uuid: '364f196c-881b-4839-8bfc-9e8f651521b6', created: DateTime(2021, 09, 01), @@ -62,7 +62,7 @@ final benchPress = Exercise( translations: [benchPressEn, benchPressDe], ); -final crunches = Exercise( +final testCrunches = Exercise( id: 2, uuid: '82415754-fc4c-49ea-8ca7-1516dd36d5a0', created: DateTime(2021, 08, 01), @@ -74,7 +74,7 @@ final crunches = Exercise( translations: [crunchesEn, crunchesDe, crunchesFr], ); -final deadLift = Exercise( +final testDeadLift = Exercise( id: 3, uuid: 'ca84e2c5-5608-4d6d-ba57-6d4b6b5e7acd', created: DateTime(2021, 08, 01), @@ -86,7 +86,7 @@ final deadLift = Exercise( translations: [deadLiftEn], ); -final curls = Exercise( +final testCurls = Exercise( id: 4, uuid: '361f024c-fdf8-4146-b7d7-0c1b67c58141', created: DateTime(2021, 08, 01), @@ -98,7 +98,7 @@ final curls = Exercise( translations: [curlsEn], ); -final squats = Exercise( +final testSquats = Exercise( id: 5, uuid: '361f024c-fdf8-4146-b7d7-0c1b67c58141', created: DateTime(2021, 08, 01), @@ -110,7 +110,7 @@ final squats = Exercise( translations: [squatsEn], ); -final sideRaises = Exercise( +final testSideRaises = Exercise( id: 6, uuid: '721ff972-c568-41e3-8cf5-cf1e5c5c801c', created: DateTime(2022, 11, 01), @@ -213,16 +213,16 @@ final sideRaisesEn = Translation( ); List getTestExercises() { - return [benchPress, crunches, deadLift, curls, squats, sideRaises]; + return [testBenchPress, testCrunches, testDeadLift, testCurls, testSquats, testSideRaises]; } List getScreenshotExercises() { - benchPress.translations = benchPressTranslations; - crunches.translations = crunchesTranslations; - deadLift.translations = deadLiftTranslations; - curls.translations = curlsTranslations; - squats.translations = squatsTranslations; - sideRaises.translations = raisesTranslations; + testBenchPress.translations = benchPressTranslations; + testCrunches.translations = crunchesTranslations; + testDeadLift.translations = deadLiftTranslations; + testCurls.translations = curlsTranslations; + testSquats.translations = squatsTranslations; + testSideRaises.translations = raisesTranslations; - return [benchPress, crunches, deadLift, curls, squats, sideRaises]; + return [testBenchPress, testCrunches, testDeadLift, testCurls, testSquats, testSideRaises]; } diff --git a/test_data/routines.dart b/test_data/routines.dart index 7c210958..89ec2f8f 100644 --- a/test_data/routines.dart +++ b/test_data/routines.dart @@ -138,7 +138,6 @@ Routine getTestRoutine({List? exercises}) { value: 5, operation: '+', step: 'abs', - needLogToApply: false, requirements: null, repeat: true, ),