ccomeaux / boardgamegeek4android

BoardGameGeek application for Android (unofficial)
GNU General Public License v3.0
228 stars 47 forks source link

Problem with decimals scores #136

Open zoki666 opened 4 years ago

zoki666 commented 4 years ago

If a match is scored with decimals, the statistics are shown incorrect.

It may have something to do with the decimal symbol depending on the language (in some places comma, in other places), I don't know ...

Kaligula0 commented 4 years ago

I see same bug here. In Poland we use comma as a decimal separator, I think that generates bugs here.

When I input a fractional score e.g. 64.5 it saves and shows up as 64,5 (comma instead of period) → AND I suppose then app doesn't count it as a number. This causes three bugs: 1) An opponent with lower integer score (e.g. 62) is automatically selected as winner. 2) If I want to change the score again, it disappears in numpad view. 1) The score doesn't count for player's stats (because it's NaN).

Kaligula0 commented 4 years ago

O.K., I checked that. This changes with system settings. When I set my phone default language to English the score is saved 64.5 and: 1) it wins with 62, 2) is editable, 3) is included in stats. When I change back to Polish everything works fine (like in English) until restart of the app… (I suppose then it reads the default language setting).

ccomeaux commented 4 years ago

This will require a little research. I glanced at the code, and what I looked at I thought would handle localization. Since BGG stores the score as a string instead of a number, I have to do some parsing in the app to determine it's a number. I think I can fix this in the next minor release.

Kaligula0 commented 4 years ago

(I don't know if you saw my second comment as I wrote it in the same moment you wrote yours).

I am not sure how it is in Java/Kotlin but I've been using JavaScript for years and one can use +d to parse variable d into a number (and any string that is not a number parses to 0).

Kaligula0 commented 4 years ago

E.g. if d="1" then d + 2 => "12" and +d + 2 => 3.

Kaligula0 commented 4 years ago

Maybe just enforce using AND showing with period? Like in English notation. Just for now, as a workaround. Then we'll think of prettyfying it.

ccomeaux commented 4 years ago

OK, I've figured out how to enter a "," as a decimal separator, or whatever your phone's locale is set to. I switched my phone to Polish, I was able to enter "62,5" and it treated it like 62 and a half. So that fixes your fix 2 bugs.

To be clear, the player's stats it doesn't count for is on the game's play stats page where is shows min/max/average scores?

Kaligula0 commented 4 years ago

Yes, game's Play stats. Example below. Screenshot_20200924-223057 Screenshot_20200924-223121

Kaligula0 commented 3 years ago

I believe this eeb2278a779d5968fcb18fe73c2cb8e379c5ea0c is the solution you are talking about? :grinning:

Has anybody found the no-fractions in stats issue?

Kaligula0 commented 1 year ago

Is this supposed to be fixed? Because I think I still have the issue 🤔

bilbothebaggins commented 1 year ago

Is this supposed to be fixed? Because I think I still have the issue 🤔

I dunno about the statistics, but what I do have is the same as visible on the old screenshot: Decimal scores are not detected as the winning score. (In the pic above 10 is marked as winner, not 20,5) Likely the same issue. I have a german phone, so also "," as decimal

Marooned-MB commented 1 year ago

Unfortunately, it's still not fixed after 3 years - is the app abandoned? I have to always fix who wins when using decimal. But there is nothing I can do to fix the stats.