-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Price proof: link a date, location & currency #942
Comments
@raphodn I've just tried to update a proof, and I got the following error message. Any idea what's wrong with my call? {
"detail":[
{
"type":"extra_forbidden",
"loc":["body","app_name"],
"msg":"Extra inputs are not permitted",
"input":"off-dart integration tests",
"url":"https://errors.pydantic.dev/2.6/v/extra_forbidden"
}
]
} |
From what i see the server expects a strict list of items in the body.
|
Thank you @raphodn for your answer, now it's solved! |
What's still missing is to be able to update the proof's location. I need some thoughts on this first... |
I don't see the problem at all, actually. It's just some other fields. |
Also in terms of fields. We currently ask for a Not sure if this is maintainable in the long run. I'll see :) |
Anyway you already have to deal with incoherences, e.g.:
|
True, but the incoherences would only come from non-web-or-mobile users (that use the API directly). |
Indeed. Btw I've just tried to create a price with a value for price_per (never tried before), and the value doesn't seem to be set (it is null). |
What value did you try for |
@raphodn Understood now that price_per is only for non-barcodes, thanks! |
Oh yeah I see the problem, we only do the validation on create, not update 🤦 |
ok @monsieurtanuki I did some quick changes in the backend here : openfoodfacts/open-prices#342 & openfoodfacts/open-prices#343
Doing some fixes in the frontend to reflect this : openfoodfacts/open-prices-frontend#668 I merged so its available in staging, i'll wait for your go to deploy in prod (to be sure that it doesn't break your current price/proof addition in the mobile app) |
@raphodn I've just re-run our 17 off-dart tests about prices, and they all pass. |
Ok awesome, I'll deploy then, so that if there is any issue I can fix it tonight or tomorrow 🙏 |
@raphodn LGTM: I've just added a receipt today with Smoothie (without changing anything in the code) |
On the "location update" subject I just created an issue for a new endpoint to create a location, will work on it in the coming hours/days : openfoodfacts/open-prices#346 |
@raphodn I think you should systematically update the proof location/currency/date from the first price, if empty. |
Well the idea is that the location, date & currency of a proof should be mandatory. In the web app I made the changes so that the users have to provide these 3 info if you want to add a price afterwards (and there's indeed a bug/limitation if you choose an existing proof without these info). Your screenshot is a proof uploaded from mobile i presume ? Do you plan on implementing these new fields at the proof level ? It would be the best workflow don't you think ? |
These new fields are optional because some proofs (like GDPR) may have multiple locations & dates. But the idea is that they should be mandatory for PRICE_TAG & RECEIPT proofs.. Will implement these validation rules ASAP |
The screenshot was taken on a mobile, from the web app.
First the code in dart has to be reviewed, approved and merged, then it will be easy to integrate in Smoothie/ flutter.
Don't trust anyone who uses the API, by default.
Then I would recommend considering GDPR so different from receipt/price tags than they deserve a different API entry point.
Please don't! Smoothie wouldn't work anymore. |
Then how should we proceed ? This is an evolution that was validated collectively in the weekly Wednesday meeting 10 days ago. And we pushed back the mobile launch (discussion on Slack) because we considered that these changes (having a proof location, date & currency) was necassary to increase data quality and simplifying user input. cc @teolemon I'm going to do the PRs nevertheless, but won't merge them. Fyi i checked the database
|
I wasn't aware of those decisions. |
It's early stage, there's no known API users apart from the web and now the mobile, so it will be under the same |
@raphodn Fair enough, but the current Smoothie users (beta only?) won't be able to add prices while the code isn't changed / merged for Smoothie. |
As long as the price have a location/date/currency (which is the case in the mobile's current version) then we'll be able to retro-actively populate the linked proof location/date/currency fields (with a quick script). |
Perhaps it would be a good idea to keep those parameters anyway at the price level (what would a price of |
Yes for now there's no plan to remove the price location/date/currency fields 😇 |
Originally posted by @raphodn in openfoodfacts/open-prices-frontend#634 (comment)
The text was updated successfully, but these errors were encountered: