mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Rename key to be more consistent
This commit is contained in:
@@ -77,10 +77,10 @@ class SlotEntry {
|
||||
late num repetitionRounding;
|
||||
|
||||
@JsonKey(required: false, name: 'reps_configs', includeToJson: false, defaultValue: [])
|
||||
late List<BaseConfig> repsConfigs = [];
|
||||
late List<BaseConfig> repetitionsConfigs = [];
|
||||
|
||||
@JsonKey(required: false, name: 'max_reps_configs', includeToJson: false, defaultValue: [])
|
||||
late List<BaseConfig> maxRepsConfigs = [];
|
||||
late List<BaseConfig> maxRepetitionsConfigs = [];
|
||||
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
late int weightUnitId;
|
||||
@@ -137,8 +137,8 @@ class SlotEntry {
|
||||
this.maxRirConfigs = const [],
|
||||
this.restTimeConfigs = const [],
|
||||
this.maxRestTimeConfigs = const [],
|
||||
this.repsConfigs = const [],
|
||||
this.maxRepsConfigs = const [],
|
||||
this.repetitionsConfigs = const [],
|
||||
this.maxRepetitionsConfigs = const [],
|
||||
RepetitionUnit? repetitionUnit,
|
||||
WeightUnit? weightUnit,
|
||||
Exercise? exercise,
|
||||
@@ -186,8 +186,8 @@ class SlotEntry {
|
||||
|
||||
bool get hasProgressionRules {
|
||||
return weightConfigs.length > 1 ||
|
||||
repsConfigs.length > 1 ||
|
||||
maxRepsConfigs.length > 1 ||
|
||||
repetitionsConfigs.length > 1 ||
|
||||
maxRepetitionsConfigs.length > 1 ||
|
||||
nrOfSetsConfigs.length > 1 ||
|
||||
maxNrOfSetsConfigs.length > 1 ||
|
||||
rirConfigs.length > 1 ||
|
||||
@@ -209,9 +209,9 @@ class SlotEntry {
|
||||
case ConfigType.maxSets:
|
||||
return maxNrOfSetsConfigs;
|
||||
case ConfigType.reps:
|
||||
return repsConfigs;
|
||||
return repetitionsConfigs;
|
||||
case ConfigType.maxReps:
|
||||
return maxRepsConfigs;
|
||||
return maxRepetitionsConfigs;
|
||||
case ConfigType.rir:
|
||||
return rirConfigs;
|
||||
case ConfigType.maxRir:
|
||||
|
||||
@@ -66,11 +66,11 @@ SlotEntry _$SlotEntryFromJson(Map<String, dynamic> json) {
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
repsConfigs: (json['reps_configs'] as List<dynamic>?)
|
||||
repetitionsConfigs: (json['reps_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
maxRepsConfigs: (json['max_reps_configs'] as List<dynamic>?)
|
||||
maxRepetitionsConfigs: (json['max_reps_configs'] as List<dynamic>?)
|
||||
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
|
||||
@@ -102,11 +102,11 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
|
||||
maxWeightController.text = widget.entry.maxWeightConfigs.first.value.toString();
|
||||
}
|
||||
|
||||
if (widget.entry.repsConfigs.isNotEmpty) {
|
||||
repsController.text = widget.entry.repsConfigs.first.value.round().toString();
|
||||
if (widget.entry.repetitionsConfigs.isNotEmpty) {
|
||||
repsController.text = widget.entry.repetitionsConfigs.first.value.round().toString();
|
||||
}
|
||||
if (widget.entry.maxRepsConfigs.isNotEmpty) {
|
||||
maxRepsController.text = widget.entry.maxRepsConfigs.first.value.round().toString();
|
||||
if (widget.entry.maxRepetitionsConfigs.isNotEmpty) {
|
||||
maxRepsController.text = widget.entry.maxRepetitionsConfigs.first.value.round().toString();
|
||||
}
|
||||
|
||||
if (widget.entry.restTimeConfigs.isNotEmpty) {
|
||||
|
||||
@@ -37,9 +37,9 @@ void main() {
|
||||
expect(slotEntry.repetitionRounding, 1.25);
|
||||
expect(slotEntry.weightUnitId, 1);
|
||||
expect(slotEntry.weightRounding, 2.5);
|
||||
expect(slotEntry.repsConfigs.length, 1);
|
||||
expect(slotEntry.repsConfigs[0].id, 139);
|
||||
expect(slotEntry.maxRepsConfigs.length, 1);
|
||||
expect(slotEntry.repetitionsConfigs.length, 1);
|
||||
expect(slotEntry.repetitionsConfigs[0].id, 139);
|
||||
expect(slotEntry.maxRepetitionsConfigs.length, 1);
|
||||
expect(slotEntry.weightConfigs.length, 1);
|
||||
expect(slotEntry.maxWeightConfigs.length, 1);
|
||||
expect(slotEntry.nrOfSetsConfigs.length, 1);
|
||||
|
||||
@@ -126,7 +126,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
nrOfSetsConfigs: [
|
||||
BaseConfig.firstIteration(4, 1),
|
||||
],
|
||||
repsConfigs: [
|
||||
repetitionsConfigs: [
|
||||
BaseConfig.firstIteration(3, 1),
|
||||
],
|
||||
weightConfigs: [
|
||||
@@ -170,7 +170,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
weightConfigs: [
|
||||
BaseConfig.firstIteration(80, 1),
|
||||
],
|
||||
repsConfigs: [
|
||||
repetitionsConfigs: [
|
||||
BaseConfig.firstIteration(5, 1),
|
||||
],
|
||||
nrOfSetsConfigs: [
|
||||
@@ -198,7 +198,7 @@ Routine getTestRoutine({List<Exercise>? exercises}) {
|
||||
nrOfSetsConfigs: [
|
||||
BaseConfig.firstIteration(4, 1),
|
||||
],
|
||||
repsConfigs: [
|
||||
repetitionsConfigs: [
|
||||
BaseConfig.firstIteration(12, 1),
|
||||
],
|
||||
weightConfigs: [
|
||||
|
||||
Reference in New Issue
Block a user