Closed fuddl closed 1 year ago
I would like to give it a try.
@galnaf is having the same issue on packaging
https://user-images.githubusercontent.com/1689815/220296815-cc36c997-b509-41a0-8e06-42dfd3b5e5a6.MP4
That makes sense, it's the same widget used in both cases. @sarkartanmay393 First, did you reproduce the bug with the latest code? There were recent code changes, actually.
Bumping to P0
I found what probably causes the problem: some kind of discrepancy between the input and the output format
final decimalNumberFormat = NumberFormat(
'####0.#####',
'en_US',
);
final double toto1 = decimalNumberFormat.parse('6.85').toDouble();
print('$toto1'); // 6.85
final double toto2 = decimalNumberFormat.parse('6,85').toDouble();
print('$toto2'); // 685.0
In the latest video the problem is that the keyboard is French-like (comma is the decimal separator) and the app language is English.
Which means we write 6,85
with the keyboard, and we change that into 685
as we parse it in English.
The fix would be: whatever the keyboard displays, we should replace the decimal separator with the app language decimal separator before parsing it.
I don't think I'll be able to fix it (or to test my fix) with my limited access to a computer. I'd be happy to help whoever wants to fix it.
Additional info: we replace decimal separators in method formatEditUpdate
in class DecimalSeparatorRewriter
, and perhaps that's where the fix should be.
I somehow managed to delete all nutrients of a product without really trying (see the history in https://world.openfoodfacts.org/product/1234567890123/dev-test-do-not-delete). I need to reproduce the issue once more. However, the comma thing comes through ok
Can't reproduce.. Go figure. That looks good to me
@teolemon Just curious: were you connected as hungergames
?
February 23, 2023 at 1:41:48 PM CET - hungergames Data (Changed: data_sources) -- Nutriments (Changed: carbohydrates) (Deleted: energy-kcal, energy, fat, saturated-fat, sugars, proteins, salt, sodium) - (app)- Smoothie - OpenFoodFacts - 4.4.0+968 - android+T2B3.230109.004 - 4c2e8196-346f-42d4-8265-697a90efcc6c - view
The Data (Changed: data_sources)
is a bit strange, as it does not happen that often. Where does that come from?
What
I cannot enter nutrient amounts with decimal seperator because it will dissappear after saving.
Steps to reproduce the behavior
Expected behavior
The nutrient should have an amount with a decimal seperator.
Screenshot
Smartphone model
Additional context
Please note: on the screenshots you can see I'm only able enter amounts with a
,
for a decimal seperator. I don't know why. I would expect.
instead.