openfoodfacts / smooth-app

The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart

Home Page:https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty chip in some cases on price page

teolemon opened this issue · comments

Problem

Empty chip in some cases on price page
Screenshot_20240623-093709.png

The empty chip is there because there's no brand and we get an empty string as brand.
A solution would be not to display product price chip if the text is empty.
Another solution would be to display something more interesting, cf. the web app, and even to let the user set the brand (and the quantity) at the OFF level (though this would be a frustrating experience because OFF would be updated but not Prices).

cf. https://prices.openfoodfacts.org/app/products/26014586: there's no brand and no weight.
image

cf. https://prices.openfoodfacts.org/api/v1/prices?product_code=26014586: brands is not null, but empty

{
  "items": [
    {
      "product_code": "26014586",
      "product_name": null,
      "category_tag": null,
      "labels_tags": null,
      "origins_tags": null,
      "price": 2.59,
      "price_is_discounted": false,
      "price_without_discount": null,
      "price_per": null,
      "currency": "EUR",
      "location_osm_id": 1793355690,
      "location_osm_type": "NODE",
      "date": "2024-06-17",
      "proof_id": 7407,
      "id": 28564,
      "product_id": 229240,
      "location_id": 27,
      "owner": "teolemon",
      "created": "2024-06-17T18:22:57.206315Z",
      "product": {
        "code": "26014586",
        "price_count": 1,
        "id": 229240,
        "source": "off",
        "product_name": "Wraps jambon brebis",
        "product_quantity": null,
        "product_quantity_unit": null,
        "categories_tags": [
          "en:sandwiches",
          "en:wraps"
        ],
        "brands": "",
        "brands_tags": [],
        "labels_tags": [],
        "image_url": "https://images.openfoodfacts.org/images/products/26014586/front_fr.34.400.jpg",
        "nutriscore_grade": "c",
        "ecoscore_grade": "unknown",
        "nova_group": 4,
        "unique_scans_n": 4,
        "created": "2024-01-11T06:06:12.090492Z",
        "updated": "2024-06-19T09:07:58.803380Z"
      },
      "proof": {
        "id": 7407,
        "file_path": "0008/bD5KabVSs7.jpg",
        "mimetype": "image/jpeg",
        "type": "RECEIPT",
        "price_count": 13,
        "owner": "teolemon",
        "created": "2024-06-17T18:22:56.973793Z"
      },
      "location": {
        "osm_id": 1793355690,
        "osm_type": "NODE",
        "price_count": 91,
        "id": 27,
        "osm_name": "ALDI",
        "osm_display_name": "ALDI, 86, Rue Édouard Vaillant, Levallois-Perret, Nanterre, Hauts-de-Seine, Île-de-France, France métropolitaine, 92300, France",
        "osm_tag_key": "shop",
        "osm_tag_value": "supermarket",
        "osm_address_postcode": "92300",
        "osm_address_city": "Levallois-Perret",
        "osm_address_country": "France",
        "osm_address_country_code": "FR",
        "osm_lat": 48.8974057,
        "osm_lon": 2.2880062,
        "created": "2024-01-05T19:04:53.408696Z",
        "updated": "2024-06-17T18:22:59.149421Z"
      }
    }
  ],
  "total": 1,
  "page": 1,
  "size": 50,
  "pages": 1
}