Commit Graph

439 Commits

Author SHA1 Message Date
Roland Geider
db75c17c32 Slightly increase the maximum workout duration 2026-05-08 11:11:23 +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
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
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
86b2a93e87 The description_source field is now non-nullable
This makes working with it a bit easier

# Conflicts:
#	lib/models/exercises/exercise_submission.dart
#	lib/models/exercises/exercise_submission.freezed.dart
#	lib/models/exercises/exercise_submission.g.dart
2026-04-13 23:32:36 +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
40dbe842cd Move the variation to a field in the exercise 2026-04-13 12:58:17 +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
ed8203de09 Expose units in the nutritional plan 2026-03-31 11:46:38 +02:00
Madhav
3fd0de3257 Apply dart format 2026-03-12 22:48:21 +05:30
Saraswathi
efeeea85ab enhancement:persist-ingredient-filters in nutrition 2026-03-05 16:48:52 +05:30
Roland Geider
07604ab57d Add "warmup" to list of slot entry types
https://github.com/wger-project/wger/issues/2157
2026-03-02 20:18:32 +01:00
Roland Geider
92a43c6ca7 Add vegan and vegetarian fields and filters to the ingredient 2026-02-26 23:07:13 +01:00
Roland Geider
54c6ce0175 Refactor the log entry form in the gym mode.
Previously due to rebuilds the form would e.g. not stay open after
selecting a new unit (which would also not change)
2026-02-11 13:37:33 +01:00
Roland Geider
a367678b91 Properly filter dayData entries
This is needed when the "needs logs to advance" toggle is active

See https://github.com/wger-project/wger/issues/2164
2026-02-09 22:49:30 +01:00
Roland Geider
88168dc352 Some polishing, add simple test 2026-02-08 14:54:26 +01:00
cryptbrn
b8c6a73b98 add sort datetime desc when showing ingredient suggestion 2026-02-03 22:30:38 +07:00
Roland Geider
ec153c51df i18n and other cleanup 2026-01-16 17:33:28 +01:00
Roland Geider
dce1b79683 Merge branch 'master' into feature/trophies
# Conflicts:
#	lib/providers/base_provider.dart
#	lib/providers/gym_state.dart
#	lib/providers/gym_state.g.dart
#	lib/widgets/routines/gym_mode/log_page.dart
#	test/core/settings_test.mocks.dart
#	test/exercises/contribute_exercise_image_test.mocks.dart
#	test/gallery/gallery_form_test.mocks.dart
#	test/gallery/gallery_screen_test.mocks.dart
#	test/measurements/measurement_provider_test.mocks.dart
#	test/nutrition/nutritional_plan_screen_test.mocks.dart
#	test/nutrition/nutritional_plans_screen_test.mocks.dart
#	test/routine/gym_mode/gym_mode_test.mocks.dart
#	test/routine/routine_screen_test.mocks.dart
#	test/routine/routines_provider_test.mocks.dart
#	test/routine/routines_screen_test.mocks.dart
#	test/user/provider_test.mocks.dart
#	test/weight/weight_provider_test.mocks.dart
#	test/widgets/routines/gym_mode/log_page_test.dart
2026-01-16 16:54:08 +01:00
Roland Geider
53dcbd8c6c Don't mark nullable fields as "late"
These will be null and we avoid LateInitializationError errors

See #1079
2026-01-16 15:26:38 +01:00
Roland Geider
fb6a673503 Simplify code by adding new log provider
This makes the logic for copying or modifying the logs much easier. Also,
there were some user reports that the old logic sometimes behaved erratically
and old values were sometimes reverted.
2026-01-12 21:40:11 +01:00
Roland Geider
536f18805b Load context data for PR trophies
This allows us to show for which sets the user achieved new PRs
2025-12-21 20:40:20 +01:00
Roland Geider
36a3e7ef4a Add overview page for the trophies 2025-12-20 21:25:18 +01:00
Roland Geider
b9fd061d33 Add dashboard widget and rework the provider 2025-12-20 02:06:08 +01:00
Roland Geider
5d39ae5088 Start adding support for trophies 2025-12-20 00:55:33 +01:00
Roland Geider
6a2158a397 Reload the session page in the gym mode
This makes sure that we have the current state and don't try to create a new session
which already exists
2025-12-18 11:59:26 +01:00
Roland Geider
d187324a25 Properly handle null values
Basically all the fields can be nullable, so we need to set them if
we want to avoid LateInitialisation errors.
2025-12-18 10:58:40 +01:00
Roland Geider
077dcaf742 Handle HTML errors in WgerHttpException
These need to be handled separately when the server encounters an error and
returns HTML instead of JSON.
2025-12-17 18:59:45 +01:00
Roland Geider
06b32a2bd9 Better volume calculations, other cleanup 2025-12-04 12:14:57 +01:00
Roland Geider
aeb01a517b Refactor widgets used in logs
We should try to reuse as many as possible in the end-of-gym-mode logs and in
the routine log page
2025-11-27 15:08:06 +01:00
Roland Geider
ecd0b6c6b4 Add overview page when a workout has been completed 2025-11-26 20:17:02 +01:00
Roland Geider
9f66815e10 Merge branch 'master' into feature/gym-mode
# Conflicts:
#	lib/widgets/routines/gym_mode/navigation.dart
#	pubspec.lock
#	test/exercises/contribute_exercise_image_test.mocks.dart
#	test/exercises/contribute_exercise_test.mocks.dart
#	test/nutrition/nutritional_meal_form_test.mocks.dart
#	test/nutrition/nutritional_plan_form_test.mocks.dart
2025-11-19 19:18:45 +01:00
Roland Geider
fc881c4929 Properly handle timezones
This should (hopefully 🤞) take care of problems saving entries with timezone
information.
2025-11-18 16:30:52 +01:00
Roland Geider
c26e3828f8 Allow adding additional exercises to the workout
While these are not real ad-hoc workouts, at least it's a first step
2025-11-15 23:44:42 +01:00
Roland Geider
f1f37d3e03 Allow swapping exercises in the gym mode 2025-11-15 01:32:59 +01:00
Roland Geider
ae6db6ee07 Move to riverpod three
Needed to downgrade build_runner and mockito for now
2025-11-11 13:22:18 +01:00
Roland Geider
c551b176fb Merge pull request #950 from wger-project/feature/day-type
Set day and set types
2025-10-17 00:13:50 +02:00
Roland Geider
b0d1bce9aa Consistently show the day and type name 2025-10-16 23:48:15 +02:00
Roland Geider
b4c77bf238 Move plate calculator visibility logic to the exercise itself 2025-10-16 21:59:56 +02:00
Roland Geider
1f6d22d85a Tweak a bit how and when the types are shown 2025-10-09 23:11:10 +02:00