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

Empty chip in some cases on price page #5437

Closed
teolemon opened this issue Jun 23, 2024 · 1 comment · Fixed by #5531
Closed

Empty chip in some cases on price page #5437

teolemon opened this issue Jun 23, 2024 · 1 comment · Fixed by #5531
Labels
🐛 bug Something isn't working good first issue Good for newcomers Prices

Comments

@teolemon
Copy link
Member

Problem

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

@monsieurtanuki
Copy link
Contributor

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working good first issue Good for newcomers Prices
Development

Successfully merging a pull request may close this issue.

2 participants