Giter Club home page Giter Club logo

Comments (10)

teolemon avatar teolemon commented on August 12, 2024 1

We created that when we didn't have efficient editing, and also for offline editing (where tags on server might - 5% chance - have changed). It's more of a safety measure than anything else, but if you retrieve existing values, show them to the user, let them edit them, and send everything, we do not need them (assuming that the last user who speaks is right)

from openfoodfacts-dart.

teolemon avatar teolemon commented on August 12, 2024 1

It might be useful for other apps, but I'd rather have destructive editing for Smoothie (the whole point of the tag picker)

from openfoodfacts-dart.

MohamedFBoussaid avatar MohamedFBoussaid commented on August 12, 2024

@teolemon I guess once this implemented I should rollback my changes here ? #128

Otherwise writing labels, categories with saveProduct() will delete the previous values and keep only the last input

from openfoodfacts-dart.

teolemon avatar teolemon commented on August 12, 2024

@MohamedFBoussaid What's the current behavior ? We could have both ways, a full replace or a patch solution ?
add_ has some limitations as well (it does not allow for precision editing)

from openfoodfacts-dart.

monsieurtanuki avatar monsieurtanuki commented on August 12, 2024

I suggest a new method like this one:

static Future<Status> OpenFoodAPIClient.addToProduct(
    User user,
    Product product,
    Map<AddableField, String> addedValues, {
    QueryType queryType = QueryType.PROD,
  })

with AddableField being an enum (BRANDS, LABELS, CATEGORIES, ...)
That would have no impact on @MohamedFBoussaid's code.
@teolemon Would that suit your needs?

from openfoodfacts-dart.

VaiTon avatar VaiTon commented on August 12, 2024

@teolemon Would that suit your needs?

I think it would. I think editing the product is the main behavior we want to keep as a default here. @teolemon any thoughts?

from openfoodfacts-dart.

M123-dev avatar M123-dev commented on August 12, 2024

Yeah lets do it like that

from openfoodfacts-dart.

monsieurtanuki avatar monsieurtanuki commented on August 12, 2024

@VaiTon Any idea about the list of addable fields? Will they all be accepting String as value?

from openfoodfacts-dart.

VaiTon avatar VaiTon commented on August 12, 2024

@VaiTon Any idea about the list of addable fields? Will they all be accepting String as value?

I think every field has an 'add' version except from code and lang. (From here https://wiki.openfoodfacts.org/API/Write)

Yes, everything can be sent as a string.

On android we have atm:

const val ADD_BRANDS = "add_brands"
const val ADD_PURCHASE = "add_purchase_places"
const val ADD_STORES = "add_stores"
const val ADD_COUNTRIES = "add_countries"
const val ADD_TRACES = "add_traces"

from openfoodfacts-dart.

monsieurtanuki avatar monsieurtanuki commented on August 12, 2024

@teolemon The way I understand your comment, you mean that this issue is pointless, should be closed and that the related PR should be ignored, am I right?

from openfoodfacts-dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.