Merge pull request #822 from wger-project/fix/default-rounding-values

Remove default rounding values
This commit is contained in:
Roland Geider
2025-05-16 15:15:26 +02:00
committed by GitHub
4 changed files with 12 additions and 12 deletions

View File

@@ -105,11 +105,11 @@ class SetConfigData {
required this.weight,
this.maxWeight,
this.weightUnitId = WEIGHT_UNIT_KG,
this.weightRounding = 1.25,
this.weightRounding = null,
required this.repetitions,
this.maxRepetitions,
this.repetitionsUnitId = REP_UNIT_REPETITIONS_ID,
this.repetitionsRounding = 1,
this.repetitionsRounding = null,
required this.rir,
this.maxRir,
required this.rpe,

View File

@@ -42,13 +42,13 @@ SetConfigData _$SetConfigDataFromJson(Map<String, dynamic> json) {
maxWeight: stringToNumNull(json['max_weight'] as String?),
weightUnitId: (json['weight_unit'] as num?)?.toInt() ?? WEIGHT_UNIT_KG,
weightRounding: json['weight_rounding'] == null
? 1.25
? null
: 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,
repetitionsRounding: json['repetitions_rounding'] == null
? 1
? null
: stringToNumNull(json['repetitions_rounding'] as String?),
rir: stringToNumNull(json['rir'] as String?),
maxRir: stringToNumNull(json['max_rir'] as String?),

View File

@@ -73,8 +73,8 @@ class SlotEntry {
@JsonKey(includeFromJson: false, includeToJson: false)
late RepetitionUnit? repetitionUnitObj;
@JsonKey(required: true, name: 'repetition_rounding', fromJson: stringToNum)
late num repetitionRounding;
@JsonKey(required: true, name: 'repetition_rounding', fromJson: stringToNumNull)
late num? repetitionRounding;
@JsonKey(required: false, name: 'repetitions_configs', includeToJson: false, defaultValue: [])
late List<BaseConfig> repetitionsConfigs = [];
@@ -88,8 +88,8 @@ class SlotEntry {
@JsonKey(includeFromJson: false, includeToJson: false)
late WeightUnit? weightUnitObj;
@JsonKey(required: true, name: 'weight_rounding', fromJson: stringToNum)
late num weightRounding;
@JsonKey(required: true, name: 'weight_rounding', fromJson: stringToNumNull)
late num? weightRounding;
@JsonKey(required: false, name: 'weight_configs', includeToJson: false, defaultValue: [])
late List<BaseConfig> weightConfigs = [];
@@ -174,10 +174,10 @@ class SlotEntry {
exerciseObj = exercise;
exerciseId = exercise.id!;
this.weightUnitId = weightUnitId ?? WEIGHT_UNIT_KG;
this.weightRounding = weightRounding ?? 2.5;
this.weightRounding = weightRounding;
this.repetitionUnitId = repetitionUnitId ?? REP_UNIT_REPETITIONS_ID;
this.repetitionRounding = repetitionRounding ?? 1;
this.repetitionRounding = repetitionRounding;
}
get rir {

View File

@@ -30,9 +30,9 @@ SlotEntry _$SlotEntryFromJson(Map<String, dynamic> json) {
type: json['type'] as String,
exerciseId: (json['exercise'] as num).toInt(),
repetitionUnitId: (json['repetition_unit'] as num?)?.toInt(),
repetitionRounding: stringToNum(json['repetition_rounding'] as String?),
repetitionRounding: stringToNumNull(json['repetition_rounding'] as String?),
weightUnitId: (json['weight_unit'] as num?)?.toInt(),
weightRounding: stringToNum(json['weight_rounding'] as String?),
weightRounding: stringToNumNull(json['weight_rounding'] as String?),
comment: json['comment'] as String,
weightConfigs: (json['weight_configs'] as List<dynamic>?)
?.map((e) => BaseConfig.fromJson(e as Map<String, dynamic>))