Skip to content
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

Show the Products Edited by the user #2315

Closed
teolemon opened this issue Jun 19, 2022 · 16 comments · Fixed by #2321, #2332 or #2521
Closed

Show the Products Edited by the user #2315

teolemon opened this issue Jun 19, 2022 · 16 comments · Fixed by #2321, #2332 or #2521
Assignees
Labels
🐛 bug Something isn't working ✏️ Contribution 👥 User management Account login, signup, signout

Comments

@teolemon
Copy link
Member

teolemon commented Jun 19, 2022

What

Mockup

image

@M123-dev
Copy link
Member

@teolemon links or pages on the app

@teolemon
Copy link
Member Author

Native pages of products in the app, so that people can go back to those products, and work on them

@M123-dev M123-dev changed the title Add the links to Products Edited by the user Show the Products Edited by the user Jun 19, 2022
@teolemon teolemon added 👥 User management Account login, signup, signout ✏️ Contribution labels Jun 19, 2022
@teolemon
Copy link
Member Author

teolemon commented Jun 19, 2022

@monsieurtanuki monsieurtanuki self-assigned this Jun 19, 2022
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 19, 2022
…le screen

New files:
* `contributor_product_query.dart`: User Product Search, in "contributor" mode.
* `informer_product_query.dart`: User Product Search, in "informer" mode.
* `paged_search_product_query.dart`: Back-end paged queries around search.
* `paged_user_product_query.dart`: Back-end paged queries around User.
* `photographer_product_query.dart`: User Product Search, in "photographer" mode.
* `to_be_completed_product_query.dart`: User Product Search, in "to be completed" mode.

Impacted files:
* `category_product_query.dart`: refactored with new class `PagedSearchProductQuery`
* `keywords_product_query.dart`: refactored with new class `PagedSearchProductQuery`
* `paged_product_query.dart`: now limited to page management
* `product_list.dart`: added `enum`s and constructors around user queries
* `product_list_page.dart`: added cases for the new 4 product list types
* `product_query_page_helper.dart`: added cases for the new 4 product list types
* `user_preferences_account.dart`
monsieurtanuki added a commit that referenced this issue Jun 19, 2022
)

New files:
* `contributor_product_query.dart`: User Product Search, in "contributor" mode.
* `informer_product_query.dart`: User Product Search, in "informer" mode.
* `paged_search_product_query.dart`: Back-end paged queries around search.
* `paged_user_product_query.dart`: Back-end paged queries around User.
* `photographer_product_query.dart`: User Product Search, in "photographer" mode.
* `to_be_completed_product_query.dart`: User Product Search, in "to be completed" mode.

Impacted files:
* `category_product_query.dart`: refactored with new class `PagedSearchProductQuery`
* `keywords_product_query.dart`: refactored with new class `PagedSearchProductQuery`
* `paged_product_query.dart`: now limited to page management
* `product_list.dart`: added `enum`s and constructors around user queries
* `product_list_page.dart`: added cases for the new 4 product list types
* `product_query_page_helper.dart`: added cases for the new 4 product list types
* `user_preferences_account.dart`
Repository owner moved this from To discuss and validate to Done in 🤳🥫 The Open Food Facts mobile app (Android & iOS) Jun 19, 2022
@monsieurtanuki
Copy link
Contributor

The problem is that the queries are not verbose enough: we have limited data about the products => help needed!

cf. #2321

@teolemon Any suggestion?

@teolemon
Copy link
Member Author

What do you mean ? I'm not quite sure. You mean Eco-Score and Nutri-Score are not displayed ?

@teolemon
Copy link
Member Author

teolemon commented Jun 20, 2022

http://world.openfoodfacts.org/photographer/teolemon/state/to-be-completed.json?fields=XXX

monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 20, 2022
Impacted file:
* `paged_user_product_query.dart`
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 20, 2022
…localized

Impacted files:
* `app_en.arb`: added a title for each of the 4 user queries
* `app_fr.arb`: added a title for each of the 4 user queries
* `paged_user_product_query.dart`: added smoothie fields to user queries
* `product_list_page.dart`: refactored
* `product_query_page_helper.dart`: refactored by removing useless code
* `user_preferences_account.dart`: refactored and translated
monsieurtanuki added a commit that referenced this issue Jun 20, 2022
)

Impacted files:
* `app_en.arb`: added a title for each of the 4 user queries
* `app_fr.arb`: added a title for each of the 4 user queries
* `paged_user_product_query.dart`: added smoothie fields to user queries
* `product_list_page.dart`: refactored
* `product_query_page_helper.dart`: refactored by removing useless code
* `user_preferences_account.dart`: refactored and translated
@monsieurtanuki
Copy link
Contributor

Needs minor refactoring using the brand new off-dart 1.20.0 methods from openfoodfacts/openfoodfacts-dart#488.

@monsieurtanuki
Copy link
Contributor

@teolemon @stephanegigandet Actually there's a little bug I've just discovered, on the server side.

With the latest version of off-dart, we also put the language in the query. Which is a good idea, isn't it?

It works well for the first 3 queries (contributor, informer, photographer).
But for the last one ("to be completed") the server translates the URL, and that fails.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="/informateur/monsieurtanuki/etat/a-completer.json">here</a>.</p>
<hr>
<address>Apache/2.4.25 (Debian) Server at world.openfoodfacts.org Port 80</address>
</body></html>

What shall we do? Should we handle that in off-dart? Is that a bad redirection code on the server side?

@teolemon
Copy link
Member Author

teolemon commented Jul 4, 2022

@monsieurtanuki the best solution I have right now is using the States taxonomy: https://static.openfoodfacts.org/data/taxonomies/states.json

@teolemon
Copy link
Member Author

teolemon commented Jul 4, 2022

Otherwise, the tags are stored in https://github.com/openfoodfacts/openfoodfacts-server/blob/e32683cdfdf05b9e83667efaa8494c0dd17e65b4/po/tags/fr.po and not in a structured form

@monsieurtanuki
Copy link
Contributor

@teolemon What you suggest wouldn't be very elegant:

  1. we start from the "standard" url https://world.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json
  2. we translate informer (we need the translations)
  3. we translate state (we need the translations)
  4. we translate to-be-completed thanks to https://static.openfoodfacts.org/data/taxonomies/states.json that only translates in 22 languages, and for that we need to download the states.json file for each query
  5. in addition to that we must change the country too because without that it doesn't work - though that get a little awkward here - "list the products I've changed from this country"

Actually, the keys seem to be

  • setting the correct country (which was not supported so far as it didn't seem appropriate)
  • not setting the language (or translate it "your way")

Another problem is the discrepancies in the number of "to-be-completed" products depending on the countries.

count url
39 https://world.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json
4 https://it.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json
38 https://fr.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json
38 https://world.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json?cc=fr
(fails) https://world.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json?lc=fr
(fails) https://world.openfoodfacts.org/informer/monsieurtanuki/state/to-be-completed.json?lc=fr&cc=fr

What I can do for the moment is unset the language value for this specific query in Smoothie: we'll have the max number of results, and I hope not having the language as a parameter won't have side-effects.

@monsieurtanuki
Copy link
Contributor

The problem is that we cannot really force the language to null:

  • if we put null as language parameter it is not considered as "we want no value" but "please put the default value". We can fix that in Smoothie by setting the default value to null
  • but then we have another problem: all the "in-languages" fields make the app crash as there's no language

@stephanegigandet
Copy link
Contributor

@monsieurtanuki I'm fixing the redirect server side.

But those kinds of URLs (adding .json to web site URLs to get the products) should not be used in the app, they are mostly for debugging purposes.

We should use the search API instead, and there won't be redirects.

e.g. https://world.openfoodfacts.org/api/v2/search?informers_tags=monsieurtanuki&states_tags=en:to-be-completed&lc=fr&cc=fr

@stephanegigandet
Copy link
Contributor

Server side fix: openfoodfacts/openfoodfacts-server#7019

@monsieurtanuki
Copy link
Contributor

Thank you @stephanegigandet!
I'm fixing the URL according to your specs on the off-dart side too.

@stephanegigandet
Copy link
Contributor

Great, thank you!

monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jul 6, 2022
…h not English language

Deleted file:
* `tmp_to_be_completed_query_configuration.dart`: now included (and fixed) in off-dart 1.21.0

Impacted files:
* `paged_to_be_completed_product_query.dart`: now uses off-dart 1.21.0 query instead of tmp
* `Podfile.lock`: wtf
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded off-dart version to 1.21.0
monsieurtanuki added a commit that referenced this issue Jul 6, 2022
… language (#2521)

Deleted file:
* `tmp_to_be_completed_query_configuration.dart`: now included (and fixed) in off-dart 1.21.0

Impacted files:
* `paged_to_be_completed_product_query.dart`: now uses off-dart 1.21.0 query instead of tmp
* `Podfile.lock`: wtf
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded off-dart version to 1.21.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment