Repository navigation
Feat(exercises): search options - version 1.11.0 #1170 - wger-project/wger#2279 - #1182
Closed
pankaj-basnet wants to merge 16 commits into
Conversation
…s. Better search options - flutter , wger-project/wger#2279 . Backend version-2.5 & flutter version-1.11.0 lib/models/exercises/exercise_filters.dart (new) lib/helpers/shared_preferences.dart (modified)
…st file lib/providers/exercise_filters_riverpod.dart (new) lib/providers/exercise_filters_riverpod.g.dart (generated) test/exercises/exercise_filters_provider_test.dart (new)
lib/providers/exercises.dart (modified)
…ompleter and FilterRow lib/widgets/exercises/autocompleter.dart (modified) lib/widgets/exercises/filter_row.dart (modified) lib/widgets/exercises/filter_modal.dart (modified)
…flutter-1170--wger-2279
Member
|
Your other older PR #1170 can be closed right? |
|
|
||
| /// The filter icon button — opens dialog with language, category, and search mode options. | ||
| /// Mirrors the filterButton() in IngredientTypeahead. | ||
| Widget _filterButton(BuildContext context) { |
Member
There was a problem hiding this comment.
this is basically duplicated right? I would extract this to something like ExerciseFilterButton
Contributor
Author
There was a problem hiding this comment.
extracting and using the _filterButton component for IngredientTypeahead and ExerciseAutocompleter might complicate code because the logic is so tightly coupled to the providers and states. if you prefer the shared widget , let me know and I will refactor it.
…ters next, separate the new Riverpod-based filters from the legacy filter system, as per maintainer's review. - The existing Filters class in ExercisesProvider is designed for local filtering. - It loads all exercises into memory and then uses filteredItems.where(...) to narrow them down based on Category or Equipment. - create new searchExerciseWithSearchMode() function for (ExerciseFiltersNotifier) Riverpod-managed filters , to send data to backend for Server-Side Filtering.
…ded searchExerciseWithSearchMode() function in exercises provider - Integrated 'searchExerciseWithSearchMode' for exact vs. fuzzy matching, multi-language support (current vs. current+English fallback) and category filtering. - Added a 'Reset' action to the filter dialog to clear all search state via the notifier. - Switched to localized language strings (searchLanguageCurrent) as per maintainer's review/suggestion
…rovider - Add support for PostgreSQL trigram similarity via name__search - Add support for exact name matching via name__exact - Implement multi-language filtering logic (current, English fallback, or all) - Integrate category-specific filtering in search queries
…d ingredient search filters - Create search_options.dart in models/core as per maintainer's review/suggestion - Update imports in other Exercises modules code files to use centralized enums
- Add _sentinel to ExerciseFilters to allow explicit nulling of categories via copyWith - Add resetAll() to ExerciseFiltersProvider to revert to default state
- Add exerciseSearchExactName and exerciseSearchExactNameSubtitle - Add searchLanguageAll with descriptive metadata for translators
… enums - Update imports to use models/core/search_options.dart
This reverts commit 7f3e06e. revert commmit for fastlane metadata files ,commit undo
Contributor
Author
Member
|
(in case you're wondering, I couldn't push to this branch and I wanted to squash these commits) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Better search options for exercises.
Proposed Changes
Added toggle icon to show/hide multiple search options.
Added Exact Match toggle (switches API call from name__search to name__exact)
Added local storage logic to save user search preferences
Files created (new files):
lib/models/exercises/exercise_filters.dart— new data model for exercise search filterslib/providers/exercise_filters_riverpod.dart— new Riverpod notifier for filter statelib/providers/exercise_filters_riverpod.g.dart— auto-generated bydart run build_runner buildtest/exercises/exercise_filters_provider_test.dart— unit tests for the notifierFiles modified (existing files):
lib/helpers/shared_preferences.dart— add save/get methods for exercise filter preferenceslib/providers/exercises.dart— updatesearchExercise()to accept filter params, updatefindByFilters()to call API with new paramslib/widgets/exercises/filter_row.dart— add filter button (icon that shows/hides options) similar toIngredientTypeahead.filterButton()Django backend: No changes needed. The
ExerciseFilterSetinfiltersets.pynow supportsname__search(fulltext),name__exact(exact),language__code, andcategoryfilters via the existingexerciseinfoendpoint.Related Issue(s)
Please check that the PR fulfills these requirements
dart format .)