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

Nutritional values: allow to input an empty value #4745

Closed
g123k opened this issue Oct 27, 2023 · 8 comments · Fixed by #4909
Closed

Nutritional values: allow to input an empty value #4745

g123k opened this issue Oct 27, 2023 · 8 comments · Fixed by #4909
Assignees
Labels
✏️ Editing - Nutrition input 🎨 Mockups available Some mockups are available for this issue. Please check everything is ok before starting coding. nutrition facts

Comments

@g123k
Copy link
Collaborator

g123k commented Oct 27, 2023

Hi everyone,

When we edit the nutritional values of a product, we only have access to digits.
However, when there is no value on a product (eg: for fibers), many users input 0, which is incorrect.
On the server, we have to pass a - value in that case, but is not available on all keyboards (especially on iOS).

To make things clearer:

  • On each field, we will now add a button (with the eye icon from Material)
  • If it's "invisible":
    • The label No data should be displayed and the server must receive a - value
    • The field shouldn't be editable
  • Below the form, we add an explanation to clarify why a 0 value is incorrect.

Screenshot:
iPhone 13 Pro Max (1)

@monsieurtanuki
Copy link
Contributor

@g123k What if we just replaced the null value with a - when we save the data, for all displayed nutrients?
As all displayed nutrients are either deemed important in general (e.g. fibers) or important for that food (e.g. vitamin B12 if added by the user), all displayed nutrients that are not populated can be considered empty (and not just null).

With that we could get rid of your eye icon (that I find not intuitive and which takes space), while possibly keeping your warning message.

@Azad99-9
Copy link

Azad99-9 commented Nov 7, 2023

@g123k could you please assign this issue to me. I would like to work on it.

@g123k
Copy link
Collaborator Author

g123k commented Nov 13, 2023

@g123k What if we just replaced the null value with a - when we save the data, for all displayed nutrients? As all displayed nutrients are either deemed important in general (e.g. fibers) or important for that food (e.g. vitamin B12 if added by the user), all displayed nutrients that are not populated can be considered empty (and not just null).

With that we could get rid of your eye icon (that I find not intuitive and which takes space), while possibly keeping your warning message.

There is a difference between null and -.

  • null means there is no value entered (the user may have missed to fill this field)
  • - means there is no value on the product

This slight difference requires the "eye" to distinguish the 2 possible values.

@g123k could you please assign this issue to me. I would like to work on it.

Before doing that, please wait, we have a pending discussion.

@monsieurtanuki
Copy link
Contributor

@g123k I do understand the difference between - and null.
My point is that this distinction makes only sense for the main expected nutrients, and among them typically only for fibers.
Adding a column only for this case brings too much UI confusion for no added value.
My suggestion is to consider that for the main nutrients - is equivalent to null. And for the additional nutrients, either they're not added (and their value is null) or they are added with a value.

@g123k
Copy link
Collaborator Author

g123k commented Nov 17, 2023

The problem is that we have to face many cases.
In general: fibers or proteins may be missing.
But for example on a bottle of water, all the "classic fields" are not provided.

That's why having this ability and to be inline with the website, it would be better.
Yes, the eye may not be the solution, but inputting a - would require switching the layout on iOS, which would be a clear regression.

@monsieurtanuki
Copy link
Contributor

@g123k The thing is that we don't need to display -.
We may just say: "for an important field, when empty, we send - to the server, and we display an empty text field".
Basically the - would be transparent for the user, it will just be an empty field.

@teolemon
Copy link
Member

Honestly, I'm okay with @g123k's design. It has the merit of being unambiguous, unlike the server side solution:
There's no UI server side (cc @CharlesNepote ) and you have to know that exists to input it.

One day we might revisit it, but it has at least the merit to appease people who asked about it.
It's really a refinement, and we have bigger and more impactful fish to fry

@g123k
Copy link
Collaborator Author

g123k commented Dec 9, 2023

As we are now sure of the design, @Azad99-9, do you still want to implement it? 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Editing - Nutrition input 🎨 Mockups available Some mockups are available for this issue. Please check everything is ok before starting coding. nutrition facts
Development

Successfully merging a pull request may close this issue.

4 participants