Page MenuHomePhabricator

Adding a floating point value with unit results into wrong value
Closed, ResolvedPublicBUG REPORT

Description

Adding a floating point value with unit results into wrong value

Steps to reproduce

Event Timeline

Raymond created this task.Jun 5 2020, 5:50 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptJun 5 2020, 5:50 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I've tried this on multiple files, including the one listed in the ticket, and can't reproduce the problem on either Chrome or Firefox

I've tried this on multiple files, including the one listed in the ticket, and can't reproduce the problem on either Chrome or Firefox

Weird... I saw your edits and I tried it again. With 4.96 meter and 4,96 meter. both are saved as 496 meter again.

I still can't reproduce this, and I was able to edit the "496 meter" value successfully to 4.96, but I'm adding it to the team backlog for further investigation.

Wow, the difference seems to be the user language.

  • With English as user language it work well
  • With German as user language it fails

@Ramsey-WMF: Can you reproduce this, when you change your user language to German?

Ramsey-WMF changed the subtype of this task from "Task" to "Bug Report".

Confirmed. I still wasn't able to reproduce it when I used ?uselang=de in the URL, but when I set my language in my Preferences to German and attempted to set a test file's qualifier at 2.19 meters, it turned into 219 meters (tried again with other values and the result was the same).

Ramsey-WMF updated the task description. (Show Details)Jun 8 2020, 4:09 PM

Change 604002 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Use type=text input field for numeric types rather than type=number

https://gerrit.wikimedia.org/r/604002

This is actually intentional, and in line with implementation on Wikidata: in German, . is not used for decimals, , is.

That said, the current input field (type=numeric) forces numeric input to always return the value in . format, which basically makes it impossible to enter fractional values in languages where the decimal separator is not ..
Patch incoming to address that!

Change 604002 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Use type=text input field for numeric types rather than type=number

https://gerrit.wikimedia.org/r/604002

Ramsey-WMF closed this task as Resolved.Jun 22 2020, 6:22 PM

this looks fixed on production and matches implementation on Wikidata