From cacb89f8b1d05ee30a6de0ffd4aa9e10ef493cb7 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 28 Mar 2025 12:53:56 +0100 Subject: [PATCH] Replace WEIGHT_UNIT_KG_ID No need to have two constants for the same thing --- lib/helpers/consts.dart | 3 --- lib/models/workouts/slot_entry.dart | 2 +- lib/providers/routines.dart | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/helpers/consts.dart b/lib/helpers/consts.dart index db66b4f8..bdce093d 100644 --- a/lib/helpers/consts.dart +++ b/lib/helpers/consts.dart @@ -34,9 +34,6 @@ const TESTSERVER_PASSWORD = 'flutteruser'; /// Keys used in the android manifest const MANIFEST_KEY_CHECK_UPDATE = 'wger.check_min_app_version'; -/// Default weight unit is "kg" -const WEIGHT_UNIT_KG_ID = 1; - /// Default impression for a workout session (neutral) const DEFAULT_IMPRESSION = 2; diff --git a/lib/models/workouts/slot_entry.dart b/lib/models/workouts/slot_entry.dart index c613991f..3ae871a2 100644 --- a/lib/models/workouts/slot_entry.dart +++ b/lib/models/workouts/slot_entry.dart @@ -173,7 +173,7 @@ class SlotEntry { this.type = type ?? 'normal'; exerciseObj = exercise; exerciseId = exercise.id!; - this.weightUnitId = weightUnitId ?? WEIGHT_UNIT_KG_ID; + this.weightUnitId = weightUnitId ?? WEIGHT_UNIT_KG; this.weightRounding = weightRounding ?? 2.5; this.repetitionUnitId = repetitionUnitId ?? REP_UNIT_REPETITIONS_ID; diff --git a/lib/providers/routines.dart b/lib/providers/routines.dart index cd0cc06b..4b02f9cb 100644 --- a/lib/providers/routines.dart +++ b/lib/providers/routines.dart @@ -105,7 +105,7 @@ class RoutinesProvider with ChangeNotifier { /// Return the default weight unit (kg) WeightUnit get defaultWeightUnit { - return _weightUnits.firstWhere((element) => element.id == WEIGHT_UNIT_KG_ID); + return _weightUnits.firstWhere((element) => element.id == WEIGHT_UNIT_KG); } WeightUnit findWeightUnitById(int id) => _weightUnits.firstWhere((element) => element.id == id);