Skip to content

Commit

Permalink
fiber rename fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed May 29, 2024
1 parent 6356c20 commit e52f3a9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
12 changes: 6 additions & 6 deletions lib/models/nutrition/nutritional_plan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class NutritionalPlan {
@JsonKey(required: true, name: 'goal_fat')
late num? goalFat;

@JsonKey(required: true, name: 'goal_fibers')
late num? goalFibers;
@JsonKey(required: true, name: 'goal_fiber')
late num? goalFiber;

@JsonKey(includeFromJson: false, includeToJson: false, defaultValue: [])
List<Meal> meals = [];
Expand All @@ -74,7 +74,7 @@ class NutritionalPlan {
this.goalProtein,
this.goalCarbohydrates,
this.goalFat,
this.goalFibers,
this.goalFiber,
List<Meal>? meals,
List<Log>? diaryEntries,
}) {
Expand All @@ -89,7 +89,7 @@ class NutritionalPlan {
goalEnergy = null;
goalProtein = null;
goalCarbohydrates = null;
goalFibers = null;
goalFiber = null;
goalFat = null;
}

Expand All @@ -110,7 +110,7 @@ class NutritionalPlan {
}

bool get hasAnyAdvancedGoals {
return goalFibers != null;
return goalFiber != null;
}

/// Calculations
Expand All @@ -126,7 +126,7 @@ class NutritionalPlan {
fat: goalFat?.toDouble(),
protein: goalProtein?.toDouble(),
carbohydrates: goalCarbohydrates?.toDouble(),
fiber: goalFibers?.toDouble(),
fiber: goalFiber?.toDouble(),
);
}
// if there are no set goals and no defined meals, the goals are still undefined
Expand Down
9 changes: 4 additions & 5 deletions lib/models/nutrition/nutritional_plan.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/widgets/nutrition/charts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class NutritionalDiaryChartWidgetFlState extends State<NutritionalDiaryChartWidg
barchartGroup(3, barsSpace, barsWidth, 'fat'),
barchartGroup(4, barsSpace, barsWidth, 'fatSaturated'),
if (widget._nutritionalPlan.nutritionalGoals.fiber != null)
barchartGroup(5, barsSpace, barsWidth, 'fibers'),
barchartGroup(5, barsSpace, barsWidth, 'fiber'),
],
),
),
Expand Down
10 changes: 5 additions & 5 deletions lib/widgets/nutrition/forms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ class _PlanFormState extends State<PlanForm> {
widget._plan.goalProtein = null;
widget._plan.goalCarbohydrates = null;
widget._plan.goalFat = null;
widget._plan.goalFibers = null;
widget._plan.goalFiber = null;
case GoalType.basic:
widget._plan.goalFibers = null;
widget._plan.goalFiber = null;
break;
default:
break;
Expand Down Expand Up @@ -562,11 +562,11 @@ class _PlanFormState extends State<PlanForm> {

if (_goalType == GoalType.advanced)
GoalMacros(
val: widget._plan.goalFibers?.toString(),
val: widget._plan.goalFiber?.toString(),
label: AppLocalizations.of(context).goalFiber,
suffix: AppLocalizations.of(context).g,
onSave: (double value) => widget._plan.goalFibers = value,
key: const Key('field-goal-fibers'),
onSave: (double value) => widget._plan.goalFiber = value,
key: const Key('field-goal-fiber'),
),
ElevatedButton(
key: const Key(SUBMIT_BUTTON_KEY_NAME),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"goal_protein": null,
"goal_carbohydrates": null,
"goal_fat": null,
"goal_fibers": null,
"goal_fiber": null,
"language": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"goal_protein": null,
"goal_carbohydrates": null,
"goal_fat": null,
"goal_fibers": null,
"goal_fiber": null,
"description": "",
"get_nutritional_values": {
"total": {
Expand Down

0 comments on commit e52f3a9

Please sign in to comment.