Skip to content

Commit

Permalink
Merge the branch term-consistency
Browse files Browse the repository at this point in the history
Also, make sure just rename the field and don't accidentally nuke the fibre field ;)
  • Loading branch information
rolandgeider committed May 22, 2024
1 parent 352c19b commit 234cef4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 31 deletions.
4 changes: 2 additions & 2 deletions wger/nutrition/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class IngredientData:
carbohydrates_sugar: Optional[float]
fat: float
fat_saturated: Optional[float]
fibres: Optional[float]
fiber: Optional[float]
sodium: Optional[float]
code: Optional[str]
source_name: str
Expand All @@ -58,7 +58,7 @@ def sanity_checks(self):
'carbohydrates',
'carbohydrates_sugar',
'sodium',
'fibres',
'fiber',
]
for macro in macros:
value = getattr(self, macro)
Expand Down
23 changes: 0 additions & 23 deletions wger/nutrition/migrations/0022_fiber_spelling.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Generated by Django 4.2.6 on 2024-05-21 19:40
# Generated by Django 4.2.6 on 2024-05-21 19:32

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('nutrition', '0022_fiber_spelling'),
('nutrition', '0022_add_remote_id_increase_author_field_length'),
]

operations = [
migrations.RenameField(
model_name='ingredient',
old_name='fibres',
new_name='fiber',
),
migrations.RenameField(
model_name='nutritionplan',
old_name='goal_fibers',
Expand Down
4 changes: 2 additions & 2 deletions wger/nutrition/tests/test_usda.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def test_regular_response(self):
carbohydrates_sugar=None,
fat=3.24,
fat_saturated=None,
fibres=None,
fiber=None,
sodium=None,
code=None,
source_name='USDA',
Expand All @@ -228,7 +228,7 @@ def test_regular_response(self):
status=AbstractSubmissionModel.STATUS_ACCEPTED,
license_id=CC_0_LICENSE_ID,
license_author='U.S. Department of Agriculture, Agricultural Research Service, '
'Beltsville Human Nutrition Research Center. FoodData Central.',
'Beltsville Human Nutrition Research Center. FoodData Central.',
license_title='Foo With Chocolate',
license_object_url='https://fdc.nal.usda.gov/fdc-app.html#/food-details/1234567/nutrients',
)
Expand Down
2 changes: 1 addition & 1 deletion wger/nutrition/usda.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def extract_info_from_usda(product_data: dict, language: int) -> IngredientData:
carbohydrates_sugar=carbs_sugars,
fat=fats,
fat_saturated=fats_saturated,
fibres=fiber,
fiber=fiber,
sodium=sodium,
source_name=source_name,
source_url=source_url,
Expand Down

0 comments on commit 234cef4

Please sign in to comment.