Skip to content

Commit 84bdb56

Browse files
committed
Rename some constants so they are the same as in the react app
1 parent a027ea1 commit 84bdb56

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/helpers/consts.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ const DEFAULT_WEIGHT_UNIT = 1;
3636
/// Default impression for a workout session (neutral)
3737
const DEFAULT_IMPRESSION = 2;
3838

39-
/// Default weight unit is "repetition"
40-
const DEFAULT_REPETITION_UNIT = 1;
39+
// Weight and repetition units for the workout logs
40+
const REP_UNIT_REPETITIONS = 1;
41+
const REP_UNIT_TILL_FAILURE = 2;
42+
43+
const WEIGHT_UNIT_KG = 1;
44+
const WEIGHT_UNIT_LB = 2;
4145

4246
/// Time to locally cache values such as ingredients, etc
4347
const DAYS_TO_CACHE = 20;

lib/helpers/misc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ String repText(
4242
// rather "8 repetitions". If there is weight we want to output "8 x 50kg",
4343
// since the repetitions are implied. If other units are used, we always
4444
// print them
45-
if (repetitionUnitObj.id != DEFAULT_REPETITION_UNIT || weight == 0 || weight == null) {
45+
if (repetitionUnitObj.id != REP_UNIT_REPETITIONS || weight == 0 || weight == null) {
4646
out.add(repetitionUnitObj.name);
4747
}
4848
}

lib/providers/workout_plans.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class WorkoutPlansProvider with ChangeNotifier {
8585

8686
/// Return the default weight unit (reps)
8787
RepetitionUnit get defaultRepetitionUnit {
88-
return _repetitionUnit.firstWhere((element) => element.id == DEFAULT_REPETITION_UNIT);
88+
return _repetitionUnit.firstWhere((element) => element.id == REP_UNIT_REPETITIONS);
8989
}
9090

9191
List<WorkoutPlan> getPlans() {

0 commit comments

Comments
 (0)