Commit Graph

687 Commits

Author SHA1 Message Date
Anja Klipic
10cb77cffd chore: add tests for changes related to brand field 2026-05-23 13:10:16 +02:00
Roland Geider
802fc4d468 Merge pull request #1202 from pankaj-basnet/fix/fl-chart-unsupported-operation-error
fix(nutrition): resolve fl_chart app crash when toggling meal details in Nutritional Plan Detail screen
2026-05-22 09:31:05 +02:00
pankaj-basnet
90949c63fb fix(nutrition): resolve fl_chart crash on division by zero when logged/planned macros are empty in MealDiaryBarChart
Bug: Unsupported operation: Infinity or NaN toInt (package:fl_chart)
2026-05-22 01:23:57 +05:45
Roland Geider
0741fd4bb8 Better error handling
We can now distinguish between errors that should block the application, (hopefully)
transient ones that only warrant a snackbar and others that are only logged.
2026-05-21 12:09:51 +02:00
Roland Geider
ff9b7572d0 Handle github's max URL limit
If the application had too many logs, we could reach this limit and the issue
would be blank
2026-05-21 11:25:01 +02:00
Roland Geider
7e7b441faa Properly handle localized inputs in further forms 2026-05-20 21:36:49 +02:00
Roland Geider
814c1cb915 Properly handle localized inputs in the goal macros widget
Closes #1197
2026-05-20 21:23:23 +02:00
Pawel Haracz
af2d4b4191 feat(language): implement language switcher functionality and tests 2026-05-16 23:52:46 +02:00
Roland Geider
39eaf9abe0 Make the linter happy 2026-05-07 21:42:23 +02:00
Roland Geider
8e05d3ab10 Fix linting problems 2026-05-07 17:38:23 +02:00
Roland Geider
89797c4470 Merge pull request #1189 from umaidshahid/feature/930-validate-language-on-step-continue
Implement server-side language validation on exercise description steps
2026-05-07 13:23:03 +02:00
Roland Geider
34b8989e5c Add some more tests, some cleanup 2026-05-07 13:08:48 +02:00
Roland Geider
c93f03fa0b Replace pumpAndSettle with pump where possible 2026-05-07 12:27:33 +02:00
Roland Geider
1119d8bc4a Merge pull request #1186 from aria-tec/master
feat(android): implement Android 13 per-app language support (#550)
2026-05-07 11:31:32 +02:00
Roland Geider
e22f7ebbe3 Fix locale resolution logic
The previous logic didn't consult the app's supportedLocales. For the Android 13 per-app
picker this was fine (the user picked a locale that's also in `locales_config.xml`), but
for users whose primary locale wasn't in the supportedLocales list but whose secondary
one *was*, the app would fall through to English instead of honoring the secondary
2026-05-07 11:23:48 +02:00
Umaid Shahid
f62c6b2c89 Implement server-side language validation on exercise description steps
Closes #930. The validateLanguage stub in AddExerciseProvider was making
the API call but ignoring the response and always returning false. This
wires it up properly: the method now returns null on success or the
server's error message on a language mismatch (caught from the 400
WgerHttpException). The stepper's onStepContinue is now async-aware for
steps 2 (Description) and 3 (Translation) — it calls validateLanguage
after form validation passes, blocks navigation, and displays the error
inline if the check fails. Mocks regenerated to reflect the return type
change from Future<bool> to Future<String?>.
2026-05-04 00:58:29 +02:00
Roland Geider
390dadcdf0 Cleanup 2026-05-03 18:21:54 +02:00
AlexisBirling3
7fb64b2925 shortens the displayed error message and adds link to doc 2026-05-03 18:12:33 +02:00
AlexisBirling3
1cde7f3c81 adds tests for the sanity check helper 2026-05-03 18:12:33 +02:00
Roland Geider
164d553fde Improve the exercise search autocompleter
Closes #1182
Co-authored-by: Pankaj Basnet <165250380+pankaj-basnet@users.noreply.github.com>
2026-05-03 17:54:07 +02:00
kiranannadatha8
b7f7e43fa3 refactor(nutrition): collapse Nutri-Score toggle into single slider
Mirrors the React refactor in wger-project/react#1237 addressing
Roland's review — the SwitchListTile + conditional Slider pair
expressed one semantic decision ("what grade ceiling?") through two
controls. Folded "Off" into the slider itself:

- Slider stops are now Off | A | B | C | D | E (was A..E, gated by
  a SwitchListTile).
- Off position sends no `nutriscoreMax`; A..E map as before.
- Heading changed from "Filter by Nutri-Score" to "Nutri-Score
  filter", with a dynamic helper ("No filter" / "<grade> or better").
- Model: `IngredientFilters.nutriscoreMax` is now nullable; removed
  `filterNutriscore`. `copyWith` takes a `clearNutriscoreMax` flag
  because Dart's `??` cannot distinguish "no argument" from "null".
- Storage collapsed: `saveIngredientNutriscoreMax(null)` removes the
  key; `getIngredientNutriscoreMax()` returns `null` when absent.
- Riverpod notifier: removed `toggleNutriscore`; `chooseNutriscoreMax`
  now takes `NutriScore?`.
- l10n: removed `filterNutriscoreMax`; added `filterNutriscoreOff`,
  `filterNutriscoreNoFilter`, `filterNutriscoreOrBetter` (placeholder).

Tests updated: 61/61 pass.
2026-04-20 10:33:08 -04:00
kiranannadatha8
a5114851fe feat(nutrition): filter ingredient search by Nutri-Score
Adds a "Filter by Nutri-Score" switch and an A–E discrete slider to
the ingredient search filter popover. The worst acceptable grade is
sent to the backend as `nutriscore__lte=<a|b|c|d|e>`, matching the
new filter exposed by wger-project/wger#2295.

- Extend `IngredientFilters` with `filterNutriscore` + `nutriscoreMax`
- Persist both settings through `PreferenceHelper`
- Expose `toggleNutriscore` and `chooseNutriscoreMax` on the riverpod
  notifier
- Propagate `nutriscoreMax` through `NutritionPlansProvider.searchIngredient`
- Add English strings `filterNutriscore` / `filterNutriscoreMax`
- Widget tests cover: slider hidden until switch flipped, query emitted
  with/without the filter
- Update stale generated Mockito overrides across the four test files
  that mock `NutritionPlansProvider` so the new named arg lines up

Refs wger-project/wger#2295
2026-04-19 01:44:59 -04:00
Roland Geider
f9f106f5ed Directly return the exercises found by the search
While these do not land in the local cache, this is still faster and
better, and works like the ingredientSearch method.
2026-04-14 13:53:30 +02:00
Roland Geider
2dbdf996e5 Replace the deprecated /api/v2/exercise/search endpoint
We can simply use the regular "exerciseinfo" endpoint, like we do for
ingredients. We still call fetchAndSetExercise for them, which is not
efficient, but
2026-04-14 13:40:26 +02:00
Roland Geider
bceae559f7 Merge branch 'master' into feature/version-2.5 2026-04-14 12:10:20 +02:00
Roland Geider
22af0ef9ff Show vegetarian and nutriscore badge in the ingredient autocompleter 2026-04-14 00:11:03 +02:00
Roland Geider
d343e5cdf9 Add missing nutriscore info to the ingredient model
Also, make the vegan and vegetarian flags nullable, since not all products
have this information at all
2026-04-14 00:10:27 +02:00
Roland Geider
10a28ac479 Merge pull request #1175 from efrahim20319/fix/1149-log-missing-unit-defaults
fix: use unit IDs directly in Log.fromSetConfigData to prevent null on save
2026-04-13 19:57:49 +02:00
Nsimba Tamaku
fd8545f997 fix: use unit IDs directly in Log.fromSetConfigData to prevent null on save
When adding an extra exercise during a workout, addExerciseAfterPage()
creates a SetConfigData with no unit objects loaded. Log.fromSetConfigData
was using the weightUnit/repetitionUnit setters which overwrite the default
IDs with null when the objects are null, causing the server to reject the
request with a ValidationError ("Repetitions unit must be present").

Fixes #1149

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 17:10:59 +01:00
Roland Geider
435a7c6f85 Cleanup 2026-04-13 18:02:30 +02:00
Roland Geider
44af2ecaf2 Merge branch 'feature/exercise-variations' into feature/version-2.5
# Conflicts:
#	lib/models/exercises/exercise_submission.dart
#	lib/providers/add_exercise.dart
2026-04-13 16:37:07 +02:00
Roland Geider
0c5d9b83b6 Commit missing mock file 2026-04-13 16:32:08 +02:00
Roland Geider
40dbe842cd Move the variation to a field in the exercise 2026-04-13 12:58:17 +02:00
Roland Geider
4b02ee54cd Make min server version tests more robust 2026-04-10 11:06:28 +02:00
Roland Geider
659b3da422 Updated goldens 2026-04-10 10:40:40 +02:00
Roland Geider
9f41695e65 Merge branch 'feature/nutrition-units' into feature/version-2.5
# Conflicts:
#	test/nutrition/goldens/nutritional_plan_2_one_meal_with_ingredients.png
#	test/nutrition/goldens/nutritional_plan_3_both_meals_with_ingredients.png
2026-04-10 10:38:31 +02:00
Roland Geider
bdc5e541e2 Merge branch 'feature/markdown-exercises' into feature/version-2.5 2026-04-10 10:35:34 +02:00
Roland Geider
301c2e42ce Merge branch 'feature/add-warmup-type' into feature/version-2.5
# Conflicts:
#	test/core/validators_test.mocks.dart
2026-04-10 10:35:10 +02:00
Roland Geider
fc214e31b9 Updated goldens 2026-04-10 10:29:45 +02:00
Roland Geider
094259ff0c Fix test 2026-04-10 10:26:13 +02:00
Roland Geider
9971acbe5f Use correct mock file 2026-04-10 10:12:28 +02:00
Roland Geider
6e76cf6d66 Merge branch 'master' into fork/sg172003/feature/measurement-datetime-field 2026-04-09 23:49:13 +02:00
Roland Geider
8a19e398b0 Add time information to test measurement entries, update tests 2026-04-09 23:45:57 +02:00
Roland Geider
e9661f585b Updated goldens 2026-04-09 12:51:45 +02:00
Roland Geider
ed8203de09 Expose units in the nutritional plan 2026-03-31 11:46:38 +02:00
Roland Geider
fee01c6163 Fix screenshot tests 2026-03-30 00:04:32 +02:00
Roland Geider
85b261fad7 Group slots in the UI with the same exercise
This allows the user to add different slots (sets) to an exercise, like
10 x 10kg, 8 x 12kg, 6 x 15kg. Also note that this is purely a UI change,
as it was already possible to simply add the same exercise again.
2026-03-29 20:46:13 +02:00
Roland Geider
cb6c0f9804 Merge pull request #1139 from NiazSagor/fix-redundant-loading
Prevent Redundant Loading in `NutritionalPlanScreen`
2026-03-28 20:46:38 +01:00
Madhav
54a6db2e4b test(auth): stabilize API token happy-path assertion 2026-03-13 17:08:19 +05:30
darshAnup24
d780050a98 Merge branch 'wger-project:master' into feature/min-server-version-check 2026-03-12 22:42:57 +05:30