-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 719 - Suggestion Manager with suggestions for the latest input #720
Conversation
New files: * `api_suggestion_manager_test.dart`: Unit tests for `SuggestionManager` * `suggestion_manager.dart`: Manager that returns the suggestions for the latest input. Impacted files: * `open_food_api_client.dart`: added a comment mentioning `SuggestionManager`. * `openfoodfacts.dart`: exported new file `suggestion_manager.dart`
Deleted file: * `api_get_autocompleted_suggestions_test.dart`: based on a deprecated method Impacted files: * `api_get_suggestions_test.dart`: fixed test * `available_attribute_groups.dart`: now uses `HttpHelper().jsonDecode` * `available_preference_importances.dart`: now uses `HttpHelper().jsonDecode` * `events.dart`: now uses `HttpHelper().jsonDecode` * `folksonomy.dart`: now uses `HttpHelper().jsonDecode` * `http_helper.dart`: new `jsonDecode` method that deals with typical OFF server html error pages * `invalid_barcodes.dart`: now uses `HttpHelper().jsonDecode` * `open_food_api_client.dart`: now uses `HttpHelper().jsonDecode` * `ordered_nutrient_test.dart`: now uses `HttpHelper().jsonDecode` * `product_from_json_test.dart`: now uses `HttpHelper().jsonDecode` * `status.dart`: now uses `HttpHelper().jsonDecode`
Impacted file: * `http_helper.dart`: added the "software error" case to `jsonDecode` method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heyy @monsieurtanuki looks great besides some missing documentation in the README
Also, sorry for my late response, but now I'm done with exams for some time at least :D
} | ||
|
||
/// cf. https://openfoodfacts.github.io/openfoodfacts-server/reference/api-v3/#get-/api/v3/taxonomy_suggestions | ||
/// | ||
/// Consider using [SuggestionManager]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the README
I will once the code is merged, as I cannot point to the doc of a class that does not exist yet.
@@ -257,7 +260,7 @@ void main() { | |||
test('Suggestions for additives', () async { | |||
List<String> result = await OpenFoodAPIClient.getSuggestions( | |||
TagType.ADDITIVES, | |||
language: OpenFoodFactsLanguage.RUSSIAN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What impact does this have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason the test does not pass anymore in Russian.
As we more or less agreed that it was more relevant to run integration tests with server data than unit tests with local json files, once in a while we have to "fix" tests.
Thank you @M123-dev for your review! |
@M123-dev When is the doc refreshed btw? |
New files:
api_suggestion_manager_test.dart
: Unit tests forSuggestionManager
suggestion_manager.dart
: Manager that returns the suggestions for the latest input.Impacted files:
open_food_api_client.dart
: added a comment mentioningSuggestionManager
.openfoodfacts.dart
: exported new filesuggestion_manager.dart
What
SuggestionManager
that was needed for autocomplete widgets.getSuggestions
method (typically, when the oldest call takes more time than a more recent call).Fixes bug(s)