mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-02 18:19:25 +01:00
Default the weight unit from the profile for app-created entries and ad-hoc exercises
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
import 'package:drift/drift.dart' as drift;
|
||||
import 'package:wger/core/consts.dart';
|
||||
import 'package:wger/database/powersync/database.dart';
|
||||
|
||||
/// The user's editable profile preferences.
|
||||
@@ -28,6 +29,9 @@ class UserProfile {
|
||||
|
||||
bool get isMetric => weightUnitStr == 'kg';
|
||||
|
||||
/// Weight unit implied by the metric preference: kg for metric users, lb otherwise.
|
||||
int get defaultWeightUnitId => isMetric ? WEIGHT_UNIT_KG : WEIGHT_UNIT_LB;
|
||||
|
||||
/// Drift companion for local UPDATE writes routed through PowerSync.
|
||||
UserProfileTableCompanion toCompanion() {
|
||||
return UserProfileTableCompanion(
|
||||
|
||||
@@ -35,9 +35,7 @@ SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
|
||||
return SetConfigData(
|
||||
exerciseId: (json['exercise'] as num).toInt(),
|
||||
slotEntryId: (json['slot_entry_id'] as num).toInt(),
|
||||
type:
|
||||
$enumDecodeNullable(_$SlotEntryTypeEnumMap, json['type']) ??
|
||||
SlotEntryType.normal,
|
||||
type: $enumDecodeNullable(_$SlotEntryTypeEnumMap, json['type']) ?? SlotEntryType.normal,
|
||||
nrOfSets: json['sets'] as num?,
|
||||
maxNrOfSets: json['max_sets'] as num?,
|
||||
weight: stringToNumNull(json['weight'] as String?),
|
||||
@@ -46,8 +44,7 @@ SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
|
||||
weightRounding: stringToNumNull(json['weight_rounding'] as String?),
|
||||
repetitions: stringToNumNull(json['repetitions'] as String?),
|
||||
maxRepetitions: stringToNumNull(json['max_repetitions'] as String?),
|
||||
repetitionsUnitId:
|
||||
(json['repetitions_unit'] as num?)?.toInt() ?? REP_UNIT_REPETITIONS_ID,
|
||||
repetitionsUnitId: (json['repetitions_unit'] as num?)?.toInt() ?? REP_UNIT_REPETITIONS_ID,
|
||||
repetitionsRounding: stringToNumNull(
|
||||
json['repetitions_rounding'] as String?,
|
||||
),
|
||||
@@ -61,29 +58,28 @@ SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SetConfigDataToJson(SetConfigData instance) =>
|
||||
<String, dynamic>{
|
||||
'exercise': instance.exerciseId,
|
||||
'slot_entry_id': instance.slotEntryId,
|
||||
'type': _$SlotEntryTypeEnumMap[instance.type]!,
|
||||
'text_repr': instance.textRepr,
|
||||
'sets': instance.nrOfSets,
|
||||
'max_sets': instance.maxNrOfSets,
|
||||
'weight': instance.weight,
|
||||
'max_weight': instance.maxWeight,
|
||||
'weight_unit': instance.weightUnitId,
|
||||
'weight_rounding': instance.weightRounding,
|
||||
'repetitions': instance.repetitions,
|
||||
'max_repetitions': instance.maxRepetitions,
|
||||
'repetitions_unit': instance.repetitionsUnitId,
|
||||
'repetitions_rounding': instance.repetitionsRounding,
|
||||
'rir': instance.rir,
|
||||
'max_rir': instance.maxRir,
|
||||
'rpe': instance.rpe,
|
||||
'rest': instance.restTime,
|
||||
'max_rest': instance.maxRestTime,
|
||||
'comment': instance.comment,
|
||||
};
|
||||
Map<String, dynamic> _$SetConfigDataToJson(SetConfigData instance) => <String, dynamic>{
|
||||
'exercise': instance.exerciseId,
|
||||
'slot_entry_id': instance.slotEntryId,
|
||||
'type': _$SlotEntryTypeEnumMap[instance.type]!,
|
||||
'text_repr': instance.textRepr,
|
||||
'sets': instance.nrOfSets,
|
||||
'max_sets': instance.maxNrOfSets,
|
||||
'weight': instance.weight,
|
||||
'max_weight': instance.maxWeight,
|
||||
'weight_unit': instance.weightUnitId,
|
||||
'weight_rounding': instance.weightRounding,
|
||||
'repetitions': instance.repetitions,
|
||||
'max_repetitions': instance.maxRepetitions,
|
||||
'repetitions_unit': instance.repetitionsUnitId,
|
||||
'repetitions_rounding': instance.repetitionsRounding,
|
||||
'rir': instance.rir,
|
||||
'max_rir': instance.maxRir,
|
||||
'rpe': instance.rpe,
|
||||
'rest': instance.restTime,
|
||||
'max_rest': instance.maxRestTime,
|
||||
'comment': instance.comment,
|
||||
};
|
||||
|
||||
const _$SlotEntryTypeEnumMap = {
|
||||
SlotEntryType.normal: 'normal',
|
||||
|
||||
@@ -130,6 +130,7 @@ class SlotEntry {
|
||||
@JsonKey(required: false, name: 'max_repetitions_configs', includeToJson: false)
|
||||
late List<BaseConfig> maxRepetitionsConfigs = [];
|
||||
|
||||
/// Null means no explicit unit; the user's profile default (kg/lb) applies.
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
late int? weightUnitId;
|
||||
|
||||
@@ -210,7 +211,7 @@ class SlotEntry {
|
||||
int? order,
|
||||
SlotEntryType? type,
|
||||
required Exercise exercise,
|
||||
int? weightUnitId,
|
||||
this.weightUnitId,
|
||||
this.weightRounding,
|
||||
int? repetitionUnitId,
|
||||
this.repetitionRounding,
|
||||
@@ -221,8 +222,6 @@ class SlotEntry {
|
||||
this.type = type ?? SlotEntryType.normal;
|
||||
exerciseObj = exercise;
|
||||
exerciseId = exercise.id;
|
||||
this.weightUnitId = weightUnitId ?? WEIGHT_UNIT_KG;
|
||||
|
||||
this.repetitionUnitId = repetitionUnitId ?? REP_UNIT_REPETITIONS_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,17 @@ import 'package:clock/clock.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:wger/core/consts.dart';
|
||||
import 'package:wger/core/shared_preferences.dart';
|
||||
import 'package:wger/features/account/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/features/exercises/models/exercise.dart';
|
||||
import 'package:wger/features/routines/models/log.dart';
|
||||
import 'package:wger/features/routines/models/routine.dart';
|
||||
import 'package:wger/features/routines/models/set_config_data.dart';
|
||||
import 'package:wger/features/routines/models/weight_unit.dart';
|
||||
import 'package:wger/features/routines/providers/gym_log_notifier.dart';
|
||||
import 'package:wger/features/routines/providers/gym_state.dart';
|
||||
import 'package:wger/features/routines/providers/routines_notifier.dart';
|
||||
|
||||
part 'gym_state_notifier.g.dart';
|
||||
|
||||
@@ -431,6 +435,14 @@ class GymStateNotifier extends _$GymStateNotifier {
|
||||
String pageEntryUUID, {
|
||||
required Exercise newExercise,
|
||||
}) {
|
||||
// Ad-hoc set configs bypass routine hydration, so resolve the profile
|
||||
// default weight unit (kg/lb) here; the log draft picks it up from the
|
||||
// unit object.
|
||||
final profile = ref.read(userProfileProvider).value;
|
||||
final weightUnits = ref.read(routineWeightUnitProvider).value ?? const <WeightUnit>[];
|
||||
final defaultWeightUnitId = profile?.defaultWeightUnitId ?? WEIGHT_UNIT_KG;
|
||||
final defaultWeightUnit = weightUnits.firstWhereOrNull((u) => u.id == defaultWeightUnitId);
|
||||
|
||||
final List<PageEntry> pages = [];
|
||||
for (final page in state.pages) {
|
||||
pages.add(page);
|
||||
@@ -450,6 +462,7 @@ class GymStateNotifier extends _$GymStateNotifier {
|
||||
exerciseId: newExercise.id,
|
||||
exercise: newExercise,
|
||||
slotEntryId: setConfigData.slotEntryId,
|
||||
weightUnit: defaultWeightUnit,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -147,10 +147,10 @@ class RoutinesRiverpod extends _$RoutinesRiverpod {
|
||||
final weightUnits = ref.read(routineWeightUnitProvider).value ?? const <WeightUnit>[];
|
||||
final profile = ref.read(userProfileProvider).value;
|
||||
|
||||
// Used for set configs that don't carry an explicit weight unit: kg for
|
||||
// metric users, lb otherwise. Defaults to kg while the profile is still
|
||||
// syncing (the profile listener re-hydrates once it arrives).
|
||||
final defaultWeightUnitId = (profile?.isMetric ?? true) ? WEIGHT_UNIT_KG : WEIGHT_UNIT_LB;
|
||||
// Used for slot entries and set configs that don't carry an explicit
|
||||
// weight unit. Defaults to kg while the profile is still syncing (the
|
||||
// profile listener re-hydrates once it arrives).
|
||||
final defaultWeightUnitId = profile?.defaultWeightUnitId ?? WEIGHT_UNIT_KG;
|
||||
final defaultWeightUnit = weightUnits.firstWhereOrNull((u) => u.id == defaultWeightUnitId);
|
||||
|
||||
routine.sessions = sessions.where((s) => s.routineId == routine.id).toList();
|
||||
@@ -180,9 +180,9 @@ class RoutinesRiverpod extends _$RoutinesRiverpod {
|
||||
entry.repetitionUnitObj = repetitionUnits.firstWhereOrNull(
|
||||
(u) => u.id == entry.repetitionUnitId,
|
||||
);
|
||||
entry.weightUnitObj = weightUnits.firstWhereOrNull(
|
||||
(u) => u.id == entry.weightUnitId,
|
||||
);
|
||||
entry.weightUnitObj = entry.weightUnitId != null
|
||||
? weightUnits.firstWhereOrNull((u) => u.id == entry.weightUnitId)
|
||||
: defaultWeightUnit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,7 @@ final class RoutineRepetitionUnitProvider
|
||||
List<RepetitionUnit>,
|
||||
Stream<List<RepetitionUnit>>
|
||||
>
|
||||
with
|
||||
$FutureModifier<List<RepetitionUnit>>,
|
||||
$StreamProvider<List<RepetitionUnit>> {
|
||||
with $FutureModifier<List<RepetitionUnit>>, $StreamProvider<List<RepetitionUnit>> {
|
||||
RoutineRepetitionUnitProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
@@ -87,8 +85,7 @@ final class RoutineRepetitionUnitProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$routineRepetitionUnitHash() =>
|
||||
r'de9d2c5b6e2f4df761165d6899353b3fb2cee8c6';
|
||||
String _$routineRepetitionUnitHash() => r'de9d2c5b6e2f4df761165d6899353b3fb2cee8c6';
|
||||
|
||||
@ProviderFor(RoutinesRiverpod)
|
||||
final routinesRiverpodProvider = RoutinesRiverpodProvider._();
|
||||
|
||||
@@ -299,8 +299,10 @@ void main() {
|
||||
final messages = records.where((r) => r.level == Level.INFO).map((r) => r.message);
|
||||
expect(
|
||||
messages,
|
||||
contains('PowerSync probe: https://ps.example.com/probes/liveness failed: '
|
||||
'ClientException: Connection refused'),
|
||||
contains(
|
||||
'PowerSync probe: https://ps.example.com/probes/liveness failed: '
|
||||
'ClientException: Connection refused',
|
||||
),
|
||||
);
|
||||
expect(
|
||||
messages,
|
||||
|
||||
@@ -9,19 +9,15 @@ import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/core/language.dart' as _i11;
|
||||
import 'package:wger/core/search_options.dart' as _i5;
|
||||
import 'package:wger/features/account/models/user_profile.dart' as _i14;
|
||||
import 'package:wger/features/account/providers/user_profile_repository.dart'
|
||||
as _i13;
|
||||
import 'package:wger/features/account/providers/user_profile_repository.dart' as _i13;
|
||||
import 'package:wger/features/exercises/models/category.dart' as _i7;
|
||||
import 'package:wger/features/exercises/models/equipment.dart' as _i9;
|
||||
import 'package:wger/features/exercises/models/exercise_filters.dart' as _i6;
|
||||
import 'package:wger/features/exercises/models/muscle.dart' as _i10;
|
||||
import 'package:wger/features/exercises/providers/exercise_repository.dart'
|
||||
as _i3;
|
||||
import 'package:wger/features/exercises/providers/exercises_notifier.dart'
|
||||
as _i8;
|
||||
import 'package:wger/features/exercises/providers/exercise_repository.dart' as _i3;
|
||||
import 'package:wger/features/exercises/providers/exercises_notifier.dart' as _i8;
|
||||
import 'package:wger/features/routines/models/session.dart' as _i2;
|
||||
import 'package:wger/features/routines/providers/workout_session_repository.dart'
|
||||
as _i12;
|
||||
import 'package:wger/features/routines/providers/workout_session_repository.dart' as _i12;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -38,8 +34,7 @@ import 'package:wger/features/routines/providers/workout_session_repository.dart
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeWorkoutSession_0 extends _i1.SmartFake
|
||||
implements _i2.WorkoutSession {
|
||||
class _FakeWorkoutSession_0 extends _i1.SmartFake implements _i2.WorkoutSession {
|
||||
_FakeWorkoutSession_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
@@ -47,8 +42,7 @@ class _FakeWorkoutSession_0 extends _i1.SmartFake
|
||||
/// A class which mocks [ExerciseRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockExerciseRepository extends _i1.Mock
|
||||
implements _i3.ExerciseRepository {
|
||||
class MockExerciseRepository extends _i1.Mock implements _i3.ExerciseRepository {
|
||||
MockExerciseRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -136,8 +130,7 @@ class MockExerciseRepository extends _i1.Mock
|
||||
/// A class which mocks [WorkoutSessionRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutSessionRepository extends _i1.Mock
|
||||
implements _i12.WorkoutSessionRepository {
|
||||
class MockWorkoutSessionRepository extends _i1.Mock implements _i12.WorkoutSessionRepository {
|
||||
MockWorkoutSessionRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -185,8 +178,7 @@ class MockWorkoutSessionRepository extends _i1.Mock
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock
|
||||
implements _i13.UserProfileRepository {
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i13.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,13 @@ void main() {
|
||||
expect(slotEntry.maxRestTimeConfigs.length, 1);
|
||||
});
|
||||
|
||||
test('withData leaves the weight unit unset so the profile default applies', () {
|
||||
final slotEntry = SlotEntry.withData(slotId: 1, exercise: testSquats);
|
||||
|
||||
expect(slotEntry.weightUnitId, isNull);
|
||||
expect(slotEntry.weightUnitObj, isNull);
|
||||
});
|
||||
|
||||
test('Checks that an empty model correctly calculates hasProgressionRules', () {
|
||||
final slotEntry = SlotEntry.empty();
|
||||
expect(slotEntry.hasProgressionRules, false);
|
||||
|
||||
@@ -20,14 +20,20 @@ import 'package:clock/clock.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
import 'package:wger/core/shared_preferences.dart';
|
||||
import 'package:wger/features/account/models/user_profile.dart';
|
||||
import 'package:wger/features/account/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/features/account/providers/user_profile_repository.dart';
|
||||
import 'package:wger/features/routines/providers/gym_state.dart';
|
||||
import 'package:wger/features/routines/providers/gym_state_notifier.dart';
|
||||
import 'package:wger/features/routines/providers/routines_notifier.dart';
|
||||
|
||||
import '../../../../test_data/exercises.dart';
|
||||
import '../../../../test_data/routines.dart';
|
||||
import '../helpers/routine_form_test_overrides.dart';
|
||||
|
||||
void main() {
|
||||
late GymStateNotifier notifier;
|
||||
@@ -171,6 +177,52 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('GymStateNotifier.addExerciseAfterPage', () {
|
||||
test('Stamps the profile default weight unit on the ad-hoc set configs', () async {
|
||||
// Ad-hoc exercises bypass routine hydration, so the notifier itself
|
||||
// resolves the profile default: lb (id 2) for an imperial user.
|
||||
final profileRepo = MockUserProfileRepository();
|
||||
when(
|
||||
profileRepo.watchDrift(),
|
||||
).thenAnswer((_) => Stream.value(UserProfile(id: 1, weightUnitStr: 'lb')));
|
||||
|
||||
final imperialContainer = ProviderContainer.test(
|
||||
overrides: [
|
||||
userProfileRepositoryProvider.overrideWithValue(profileRepo),
|
||||
routineWeightUnitProvider.overrideWith((ref) => Stream.value(testWeightUnits)),
|
||||
],
|
||||
);
|
||||
// Let both streams emit before the notifier reads them (in the app the
|
||||
// dashboard keeps them alive long before gym mode starts).
|
||||
imperialContainer.listen(userProfileProvider, (_, _) {});
|
||||
imperialContainer.listen(routineWeightUnitProvider, (_, _) {});
|
||||
await pumpEventQueue();
|
||||
|
||||
final imperialNotifier = imperialContainer.read(gymStateProvider.notifier);
|
||||
imperialNotifier.state = imperialNotifier.state.copyWith(
|
||||
showExercisePages: true,
|
||||
showTimerPages: true,
|
||||
dayId: 1,
|
||||
iteration: 1,
|
||||
routine: getTestRoutine(),
|
||||
);
|
||||
imperialNotifier.calculatePages();
|
||||
final setPage = imperialNotifier.state.pages.firstWhere((p) => p.type == PageType.set);
|
||||
|
||||
imperialNotifier.addExerciseAfterPage(setPage.uuid, newExercise: testSquats);
|
||||
|
||||
// recalculateIndices copies the page objects, so look the page up by uuid.
|
||||
final pages = imperialNotifier.state.pages;
|
||||
final newPage = pages[pages.indexWhere((p) => p.uuid == setPage.uuid) + 1];
|
||||
expect(newPage.slotPages, isNotEmpty);
|
||||
for (final slotPage in newPage.slotPages) {
|
||||
// testWeightUnit2 has id 2 == WEIGHT_UNIT_LB.
|
||||
expect(slotPage.setConfigData!.weightUnit, testWeightUnit2);
|
||||
expect(slotPage.setConfigData!.weightUnitId, isNull);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('GymStateNotifier.calculatePages', () {
|
||||
test(
|
||||
'Correctly generates pages - exercise and timer',
|
||||
|
||||
@@ -366,8 +366,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('resolves the default weight unit from an imperial profile', () async {
|
||||
// A set config without an explicit weight unit must inherit the unit
|
||||
// implied by the profile: lb (id 2) for an imperial user, not kg.
|
||||
// A slot entry or set config without an explicit weight unit must inherit
|
||||
// the unit implied by the profile: lb (id 2) for an imperial user, not kg.
|
||||
overrideStreams(mockExerciseRepo);
|
||||
final setConfig = SetConfigData(
|
||||
exerciseId: 1,
|
||||
@@ -376,6 +376,23 @@ void main() {
|
||||
// No weightUnit / weightUnitId: the server omits it, the default applies.
|
||||
);
|
||||
final routine = Routine(id: 101, name: 'Test routine')
|
||||
..days = [
|
||||
Day(id: 1, routineId: 101, name: 'Test', order: 1)
|
||||
..slots = [
|
||||
Slot.withData(id: 1, day: 1, order: 1)
|
||||
..entries.add(
|
||||
SlotEntry(
|
||||
id: 1,
|
||||
slotId: 1,
|
||||
exerciseId: 1,
|
||||
repetitionUnitId: 1,
|
||||
repetitionRounding: null,
|
||||
weightUnitId: null,
|
||||
weightRounding: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
]
|
||||
..dayDataGym = [
|
||||
DayData(
|
||||
iteration: 1,
|
||||
@@ -417,6 +434,8 @@ void main() {
|
||||
// testWeightUnit2 has id 2 == WEIGHT_UNIT_LB.
|
||||
final hydratedConfig = result.dayDataGym[0].slots[0].setConfigs[0];
|
||||
expect(hydratedConfig.weightUnit, testWeightUnit2);
|
||||
final hydratedEntry = result.days[0].slots[0].entries[0];
|
||||
expect(hydratedEntry.weightUnitObj, testWeightUnit2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ import 'package:wger/features/routines/models/routine.dart' as _i2;
|
||||
import 'package:wger/features/routines/models/slot.dart' as _i4;
|
||||
import 'package:wger/features/routines/models/slot_entry.dart' as _i5;
|
||||
import 'package:wger/features/routines/models/weight_unit.dart' as _i9;
|
||||
import 'package:wger/features/routines/providers/routines_repository.dart'
|
||||
as _i7;
|
||||
import 'package:wger/features/routines/providers/routines_repository.dart' as _i7;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -32,35 +31,29 @@ import 'package:wger/features/routines/providers/routines_repository.dart'
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeRoutine_0 extends _i1.SmartFake implements _i2.Routine {
|
||||
_FakeRoutine_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeRoutine_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDay_1 extends _i1.SmartFake implements _i3.Day {
|
||||
_FakeDay_1(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeDay_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSlot_2 extends _i1.SmartFake implements _i4.Slot {
|
||||
_FakeSlot_2(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeSlot_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSlotEntry_3 extends _i1.SmartFake implements _i5.SlotEntry {
|
||||
_FakeSlotEntry_3(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeSlotEntry_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeBaseConfig_4 extends _i1.SmartFake implements _i6.BaseConfig {
|
||||
_FakeBaseConfig_4(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeBaseConfig_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [RoutinesRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockRoutinesRepository extends _i1.Mock
|
||||
implements _i7.RoutinesRepository {
|
||||
class MockRoutinesRepository extends _i1.Mock implements _i7.RoutinesRepository {
|
||||
MockRoutinesRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@@ -9,16 +9,13 @@ import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/core/language.dart' as _i20;
|
||||
import 'package:wger/core/search_options.dart' as _i14;
|
||||
import 'package:wger/features/account/models/user_profile.dart' as _i22;
|
||||
import 'package:wger/features/account/providers/user_profile_repository.dart'
|
||||
as _i21;
|
||||
import 'package:wger/features/account/providers/user_profile_repository.dart' as _i21;
|
||||
import 'package:wger/features/exercises/models/category.dart' as _i16;
|
||||
import 'package:wger/features/exercises/models/equipment.dart' as _i18;
|
||||
import 'package:wger/features/exercises/models/exercise_filters.dart' as _i15;
|
||||
import 'package:wger/features/exercises/models/muscle.dart' as _i19;
|
||||
import 'package:wger/features/exercises/providers/exercise_repository.dart'
|
||||
as _i13;
|
||||
import 'package:wger/features/exercises/providers/exercises_notifier.dart'
|
||||
as _i17;
|
||||
import 'package:wger/features/exercises/providers/exercise_repository.dart' as _i13;
|
||||
import 'package:wger/features/exercises/providers/exercises_notifier.dart' as _i17;
|
||||
import 'package:wger/features/routines/models/base_config.dart' as _i6;
|
||||
import 'package:wger/features/routines/models/day.dart' as _i3;
|
||||
import 'package:wger/features/routines/models/repetition_unit.dart' as _i11;
|
||||
@@ -27,10 +24,8 @@ import 'package:wger/features/routines/models/session.dart' as _i7;
|
||||
import 'package:wger/features/routines/models/slot.dart' as _i4;
|
||||
import 'package:wger/features/routines/models/slot_entry.dart' as _i5;
|
||||
import 'package:wger/features/routines/models/weight_unit.dart' as _i10;
|
||||
import 'package:wger/features/routines/providers/routines_repository.dart'
|
||||
as _i8;
|
||||
import 'package:wger/features/routines/providers/workout_session_repository.dart'
|
||||
as _i12;
|
||||
import 'package:wger/features/routines/providers/routines_repository.dart' as _i8;
|
||||
import 'package:wger/features/routines/providers/workout_session_repository.dart' as _i12;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -48,32 +43,26 @@ import 'package:wger/features/routines/providers/workout_session_repository.dart
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeRoutine_0 extends _i1.SmartFake implements _i2.Routine {
|
||||
_FakeRoutine_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeRoutine_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDay_1 extends _i1.SmartFake implements _i3.Day {
|
||||
_FakeDay_1(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeDay_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSlot_2 extends _i1.SmartFake implements _i4.Slot {
|
||||
_FakeSlot_2(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeSlot_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSlotEntry_3 extends _i1.SmartFake implements _i5.SlotEntry {
|
||||
_FakeSlotEntry_3(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeSlotEntry_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeBaseConfig_4 extends _i1.SmartFake implements _i6.BaseConfig {
|
||||
_FakeBaseConfig_4(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
_FakeBaseConfig_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_5 extends _i1.SmartFake
|
||||
implements _i7.WorkoutSession {
|
||||
class _FakeWorkoutSession_5 extends _i1.SmartFake implements _i7.WorkoutSession {
|
||||
_FakeWorkoutSession_5(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
@@ -81,8 +70,7 @@ class _FakeWorkoutSession_5 extends _i1.SmartFake
|
||||
/// A class which mocks [RoutinesRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockRoutinesRepository extends _i1.Mock
|
||||
implements _i8.RoutinesRepository {
|
||||
class MockRoutinesRepository extends _i1.Mock implements _i8.RoutinesRepository {
|
||||
MockRoutinesRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -300,8 +288,7 @@ class MockRoutinesRepository extends _i1.Mock
|
||||
/// A class which mocks [WorkoutSessionRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutSessionRepository extends _i1.Mock
|
||||
implements _i12.WorkoutSessionRepository {
|
||||
class MockWorkoutSessionRepository extends _i1.Mock implements _i12.WorkoutSessionRepository {
|
||||
MockWorkoutSessionRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -349,8 +336,7 @@ class MockWorkoutSessionRepository extends _i1.Mock
|
||||
/// A class which mocks [ExerciseRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockExerciseRepository extends _i1.Mock
|
||||
implements _i13.ExerciseRepository {
|
||||
class MockExerciseRepository extends _i1.Mock implements _i13.ExerciseRepository {
|
||||
MockExerciseRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -438,8 +424,7 @@ class MockExerciseRepository extends _i1.Mock
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock
|
||||
implements _i21.UserProfileRepository {
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i21.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user