mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Rename further instances of "reps" to "repetitions"
This commit is contained in:
@@ -24,7 +24,7 @@ import 'package:wger/models/workouts/weight_unit.dart';
|
||||
|
||||
/// Returns the text representation for a single setting, used in the gym mode
|
||||
String repText(
|
||||
num? reps,
|
||||
num? repetitions,
|
||||
RepetitionUnit repetitionUnitObj,
|
||||
num? weight,
|
||||
WeightUnit weightUnitObj,
|
||||
@@ -34,8 +34,8 @@ String repText(
|
||||
|
||||
final List<String> out = [];
|
||||
|
||||
if (reps != null) {
|
||||
out.add(formatNum(reps).toString());
|
||||
if (repetitions != null) {
|
||||
out.add(formatNum(repetitions).toString());
|
||||
|
||||
// The default repetition unit is 'reps', which we don't show unless there
|
||||
// is no weight defined so that we don't just output something like "8" but
|
||||
|
||||
@@ -63,19 +63,19 @@ class SetConfigData {
|
||||
@JsonKey(required: true, name: 'weight_rounding', fromJson: stringToNumNull)
|
||||
late num? weightRounding;
|
||||
|
||||
@JsonKey(required: true, fromJson: stringToNumNull, name: 'reps')
|
||||
@JsonKey(required: true, fromJson: stringToNumNull, name: 'repetitions')
|
||||
late num? repetitions;
|
||||
|
||||
@JsonKey(required: true, name: 'max_reps', fromJson: stringToNumNull)
|
||||
@JsonKey(required: true, name: 'max_repetitions', fromJson: stringToNumNull)
|
||||
late num? maxRepetitions;
|
||||
|
||||
@JsonKey(required: true, name: 'reps_unit')
|
||||
@JsonKey(required: true, name: 'repetitions_unit')
|
||||
late int? repetitionsUnitId;
|
||||
|
||||
@JsonKey(includeToJson: false, includeFromJson: false)
|
||||
late RepetitionUnit repetitionsUnit;
|
||||
|
||||
@JsonKey(required: true, name: 'reps_rounding', fromJson: stringToNumNull)
|
||||
@JsonKey(required: true, name: 'repetitions_rounding', fromJson: stringToNumNull)
|
||||
late num? repetitionsRounding;
|
||||
|
||||
@JsonKey(required: true)
|
||||
@@ -119,7 +119,7 @@ class SetConfigData {
|
||||
this.textRepr = '',
|
||||
Exercise? exercise,
|
||||
WeightUnit? weightUnit,
|
||||
RepetitionUnit? repsUnit,
|
||||
RepetitionUnit? repetitionsUnit,
|
||||
}) {
|
||||
if (exercise != null) {
|
||||
this.exercise = exercise;
|
||||
@@ -127,8 +127,8 @@ class SetConfigData {
|
||||
if (weightUnit != null) {
|
||||
this.weightUnit = weightUnit;
|
||||
}
|
||||
if (repsUnit != null) {
|
||||
this.repetitionsUnit = repsUnit;
|
||||
if (repetitionsUnit != null) {
|
||||
this.repetitionsUnit = repetitionsUnit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
|
||||
'max_weight',
|
||||
'weight_unit',
|
||||
'weight_rounding',
|
||||
'reps',
|
||||
'max_reps',
|
||||
'reps_unit',
|
||||
'reps_rounding',
|
||||
'repetitions',
|
||||
'max_repetitions',
|
||||
'repetitions_unit',
|
||||
'repetitions_rounding',
|
||||
'rir',
|
||||
'max_rir',
|
||||
'rpe',
|
||||
@@ -44,11 +44,12 @@ SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
|
||||
weightRounding: json['weight_rounding'] == null
|
||||
? 1.25
|
||||
: stringToNumNull(json['weight_rounding'] as String?),
|
||||
repetitions: stringToNumNull(json['reps'] as String?),
|
||||
maxRepetitions: stringToNumNull(json['max_reps'] as String?),
|
||||
repetitionsUnitId: (json['reps_unit'] as num?)?.toInt() ?? REP_UNIT_REPETITIONS_ID,
|
||||
repetitionsRounding:
|
||||
json['reps_rounding'] == null ? 1 : stringToNumNull(json['reps_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,
|
||||
repetitionsRounding: json['repetitions_rounding'] == null
|
||||
? 1
|
||||
: stringToNumNull(json['repetitions_rounding'] as String?),
|
||||
rir: json['rir'] as String?,
|
||||
maxRir: json['max_rir'] as String?,
|
||||
rpe: json['rpe'] as String?,
|
||||
@@ -70,10 +71,10 @@ Map<String, dynamic> _$SetConfigDataToJson(SetConfigData instance) => <String, d
|
||||
'max_weight': instance.maxWeight,
|
||||
'weight_unit': instance.weightUnitId,
|
||||
'weight_rounding': instance.weightRounding,
|
||||
'reps': instance.repetitions,
|
||||
'max_reps': instance.maxRepetitions,
|
||||
'reps_unit': instance.repetitionsUnitId,
|
||||
'reps_rounding': instance.repetitionsRounding,
|
||||
'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,
|
||||
|
||||
@@ -29,8 +29,8 @@ part 'slot_entry.g.dart';
|
||||
enum ConfigType {
|
||||
weight,
|
||||
maxWeight,
|
||||
reps,
|
||||
maxReps,
|
||||
repetitions,
|
||||
maxRepetitions,
|
||||
sets,
|
||||
maxSets,
|
||||
rir,
|
||||
@@ -76,10 +76,10 @@ class SlotEntry {
|
||||
@JsonKey(required: true, name: 'repetition_rounding', fromJson: stringToNum)
|
||||
late num repetitionRounding;
|
||||
|
||||
@JsonKey(required: false, name: 'reps_configs', includeToJson: false, defaultValue: [])
|
||||
@JsonKey(required: false, name: 'repetitions_configs', includeToJson: false, defaultValue: [])
|
||||
late List<BaseConfig> repetitionsConfigs = [];
|
||||
|
||||
@JsonKey(required: false, name: 'max_reps_configs', includeToJson: false, defaultValue: [])
|
||||
@JsonKey(required: false, name: 'max_repetitions_configs', includeToJson: false, defaultValue: [])
|
||||
late List<BaseConfig> maxRepetitionsConfigs = [];
|
||||
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
@@ -208,9 +208,9 @@ class SlotEntry {
|
||||
return nrOfSetsConfigs;
|
||||
case ConfigType.maxSets:
|
||||
return maxNrOfSetsConfigs;
|
||||
case ConfigType.reps:
|
||||
case ConfigType.repetitions:
|
||||
return repetitionsConfigs;
|
||||
case ConfigType.maxReps:
|
||||
case ConfigType.maxRepetitions:
|
||||
return maxRepetitionsConfigs;
|
||||
case ConfigType.rir:
|
||||
return rirConfigs;
|
||||
|
||||
@@ -66,11 +66,11 @@ SlotEntry _$SlotEntryFromJson(Map<String, dynamic> json) {
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
repetitionsConfigs: (json['reps_configs'] as List<dynamic>?)
|
||||
repetitionsConfigs: (json['repetitions_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
maxRepetitionsConfigs: (json['max_reps_configs'] as List<dynamic>?)
|
||||
maxRepetitionsConfigs: (json['max_repetitions_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
|
||||
@@ -58,8 +58,8 @@ class RoutinesProvider with ChangeNotifier {
|
||||
static const _routineConfigMaxSets = 'max-sets-config';
|
||||
static const _routineConfigWeights = 'weight-config';
|
||||
static const _routineConfigMaxWeights = 'max-weight-config';
|
||||
static const _routineConfigReps = 'reps-config';
|
||||
static const _routineConfigMaxReps = 'max-reps-config';
|
||||
static const _routineConfigRepetitions = 'repetitions-config';
|
||||
static const _routineConfigMaxRepetitions = 'max-repetitions-config';
|
||||
static const _routineConfigRir = 'rir-config';
|
||||
static const _routineConfigMaxRir = 'rest-config';
|
||||
static const _routineConfigRestTime = 'rest-config';
|
||||
@@ -584,10 +584,10 @@ class RoutinesProvider with ChangeNotifier {
|
||||
return _routineConfigWeights;
|
||||
case ConfigType.maxWeight:
|
||||
return _routineConfigMaxWeights;
|
||||
case ConfigType.reps:
|
||||
return _routineConfigReps;
|
||||
case ConfigType.maxReps:
|
||||
return _routineConfigMaxReps;
|
||||
case ConfigType.repetitions:
|
||||
return _routineConfigRepetitions;
|
||||
case ConfigType.maxRepetitions:
|
||||
return _routineConfigMaxRepetitions;
|
||||
case ConfigType.rir:
|
||||
return _routineConfigRir;
|
||||
case ConfigType.maxRir:
|
||||
|
||||
@@ -20,12 +20,12 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:wger/models/workouts/slot_entry.dart';
|
||||
|
||||
class RepsInputWidget extends StatelessWidget {
|
||||
final _repsController = TextEditingController();
|
||||
class RepetitionsInputWidget extends StatelessWidget {
|
||||
final _repetitionsController = TextEditingController();
|
||||
final SlotEntry _setting;
|
||||
final bool _detailed;
|
||||
|
||||
RepsInputWidget(this._setting, this._detailed);
|
||||
RepetitionsInputWidget(this._setting, this._detailed);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -34,7 +34,7 @@ class RepsInputWidget extends StatelessWidget {
|
||||
labelText: _detailed ? AppLocalizations.of(context).repetitions : '',
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
controller: _repsController,
|
||||
controller: _repetitionsController,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
try {
|
||||
|
||||
@@ -78,8 +78,8 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
|
||||
final weightController = TextEditingController();
|
||||
final maxWeightController = TextEditingController();
|
||||
final repsController = TextEditingController();
|
||||
final maxRepsController = TextEditingController();
|
||||
final repetitionsController = TextEditingController();
|
||||
final maxRepetitionsController = TextEditingController();
|
||||
final restController = TextEditingController();
|
||||
final maxRestController = TextEditingController();
|
||||
final rirController = TextEditingController();
|
||||
@@ -103,10 +103,11 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
}
|
||||
|
||||
if (widget.entry.repetitionsConfigs.isNotEmpty) {
|
||||
repsController.text = widget.entry.repetitionsConfigs.first.value.round().toString();
|
||||
repetitionsController.text = widget.entry.repetitionsConfigs.first.value.round().toString();
|
||||
}
|
||||
if (widget.entry.maxRepetitionsConfigs.isNotEmpty) {
|
||||
maxRepsController.text = widget.entry.maxRepetitionsConfigs.first.value.round().toString();
|
||||
maxRepetitionsController.text =
|
||||
widget.entry.maxRepetitionsConfigs.first.value.round().toString();
|
||||
}
|
||||
|
||||
if (widget.entry.restTimeConfigs.isNotEmpty) {
|
||||
@@ -126,8 +127,8 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
weightController.dispose();
|
||||
maxWeightController.dispose();
|
||||
|
||||
repsController.dispose();
|
||||
maxRepsController.dispose();
|
||||
repetitionsController.dispose();
|
||||
maxRepetitionsController.dispose();
|
||||
|
||||
restController.dispose();
|
||||
maxRestController.dispose();
|
||||
@@ -252,7 +253,7 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
controller: repsController,
|
||||
controller: repetitionsController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(labelText: i18n.repetitions),
|
||||
validator: (value) {
|
||||
@@ -266,7 +267,7 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
if (!widget.simpleMode)
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
controller: maxRepsController,
|
||||
controller: maxRepetitionsController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(labelText: i18n.max),
|
||||
validator: (value) {
|
||||
@@ -348,13 +349,13 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
repsController.text,
|
||||
ConfigType.reps,
|
||||
repetitionsController.text,
|
||||
ConfigType.repetitions,
|
||||
);
|
||||
provider.handleConfig(
|
||||
widget.entry,
|
||||
maxRepsController.text,
|
||||
ConfigType.maxReps,
|
||||
maxRepetitionsController.text,
|
||||
ConfigType.maxRepetitions,
|
||||
);
|
||||
|
||||
provider.handleConfig(
|
||||
|
||||
@@ -270,7 +270,7 @@ class LogPage extends StatefulWidget {
|
||||
class _LogPageState extends State<LogPage> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
String rirValue = SlotEntry.DEFAULT_RIR;
|
||||
final _repsController = TextEditingController();
|
||||
final _repetitionsController = TextEditingController();
|
||||
final _weightController = TextEditingController();
|
||||
var _detailed = false;
|
||||
bool _isSaving = false;
|
||||
@@ -284,7 +284,7 @@ class _LogPageState extends State<LogPage> {
|
||||
focusNode = FocusNode();
|
||||
|
||||
if (widget._configData.repetitions != null) {
|
||||
_repsController.text = widget._configData.repetitions!.toString();
|
||||
_repetitionsController.text = widget._configData.repetitions!.toString();
|
||||
}
|
||||
|
||||
if (widget._configData.weight != null) {
|
||||
@@ -295,7 +295,7 @@ class _LogPageState extends State<LogPage> {
|
||||
@override
|
||||
void dispose() {
|
||||
focusNode.dispose();
|
||||
_repsController.dispose();
|
||||
_repetitionsController.dispose();
|
||||
_weightController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -307,9 +307,9 @@ class _LogPageState extends State<LogPage> {
|
||||
icon: const Icon(Icons.remove, color: Colors.black),
|
||||
onPressed: () {
|
||||
try {
|
||||
final int newValue = int.parse(_repsController.text) - 1;
|
||||
final int newValue = int.parse(_repetitionsController.text) - 1;
|
||||
if (newValue > 0) {
|
||||
_repsController.text = newValue.toString();
|
||||
_repetitionsController.text = newValue.toString();
|
||||
}
|
||||
} on FormatException {}
|
||||
},
|
||||
@@ -320,7 +320,7 @@ class _LogPageState extends State<LogPage> {
|
||||
labelText: AppLocalizations.of(context).repetitions,
|
||||
),
|
||||
enabled: true,
|
||||
controller: _repsController,
|
||||
controller: _repetitionsController,
|
||||
keyboardType: TextInputType.number,
|
||||
focusNode: focusNode,
|
||||
onFieldSubmitted: (_) {},
|
||||
@@ -342,8 +342,8 @@ class _LogPageState extends State<LogPage> {
|
||||
icon: const Icon(Icons.add, color: Colors.black),
|
||||
onPressed: () {
|
||||
try {
|
||||
final int newValue = int.parse(_repsController.text) + 1;
|
||||
_repsController.text = newValue.toString();
|
||||
final int newValue = int.parse(_repetitionsController.text) + 1;
|
||||
_repetitionsController.text = newValue.toString();
|
||||
} on FormatException {}
|
||||
},
|
||||
),
|
||||
@@ -544,7 +544,7 @@ class _LogPageState extends State<LogPage> {
|
||||
onTap: () {
|
||||
setState(() {
|
||||
// Text field
|
||||
_repsController.text = log.repetitions.toString();
|
||||
_repetitionsController.text = log.repetitions.toString();
|
||||
_weightController.text = log.weight.toString();
|
||||
|
||||
// Drop downs
|
||||
|
||||
4
test/fixtures/routines/slot_entry.json
vendored
4
test/fixtures/routines/slot_entry.json
vendored
@@ -9,7 +9,7 @@
|
||||
"config": null,
|
||||
"repetition_unit": 1,
|
||||
"repetition_rounding": "1.25",
|
||||
"reps_configs": [
|
||||
"repetitions_configs": [
|
||||
{
|
||||
"id": 139,
|
||||
"slot_entry": 143,
|
||||
@@ -22,7 +22,7 @@
|
||||
"requirements": null
|
||||
}
|
||||
],
|
||||
"max_reps_configs": [
|
||||
"max_repetitions_configs": [
|
||||
{
|
||||
"id": 1,
|
||||
"slot_entry": 143,
|
||||
|
||||
@@ -245,7 +245,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 4,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -266,7 +266,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 4,
|
||||
repetitions: 12,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 10,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 60,
|
||||
@@ -295,7 +295,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 4,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -352,7 +352,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 5,
|
||||
repetitions: 8,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 105,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -383,7 +383,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -397,7 +397,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -411,7 +411,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -432,7 +432,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 12,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 10,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 60,
|
||||
@@ -446,7 +446,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 12,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 10,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 60,
|
||||
@@ -460,7 +460,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 12,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 10,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 60,
|
||||
@@ -489,7 +489,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -503,7 +503,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
@@ -517,7 +517,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
slotEntryId: 1,
|
||||
nrOfSets: 1,
|
||||
repetitions: 3,
|
||||
repsUnit: testRepetitionUnit1,
|
||||
repetitionsUnit: testRepetitionUnit1,
|
||||
weight: 100,
|
||||
weightUnit: testWeightUnit1,
|
||||
restTime: 120,
|
||||
|
||||
Reference in New Issue
Block a user