Bug 464508 - Wrong correction when comparing integers with different numbers of digits in the "Compare numbers" activity
Summary: Wrong correction when comparing integers with different numbers of digits in ...
Status: RESOLVED FIXED
Alias: None
Product: gcompris
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Jazeix Johnny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-19 15:44 UTC by lcerf
Modified: 2023-01-19 17:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Second comparison is actually incorrect and the fourth one is actually correct (217.46 KB, image/png)
2023-01-19 15:44 UTC, lcerf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lcerf 2023-01-19 15:44:40 UTC
Created attachment 155426 [details]
Second comparison is actually incorrect and the fourth one is actually correct

SUMMARY
In the "Compare numbers" activity, GCompris marks as "wrong answers" answers that are actually correct.  This apparently only happens when the two compared numbers are integers with different numbers of digits.  The attached screenshot shows examples: the second comparison is actually incorrect (but the correction affirms it is correct) and the fourth one is actually correct (but the correction affirms it is incorrect).


STEPS TO REPRODUCE
1. Launch the "Compare numbers" activity.
2. "Find" a comparison between two integers with different numbers of digits.
3. Answer, clicking on "<" or ">".
4. Correct, clicking on "OK".


OBSERVED RESULT
Wrong correction.  Maybe GCompris compares the first different digits, from left to right, what is only correct if both numbers have the same number of digits.


EXPECTED RESULT
Correct correction.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Trisquel GNU/Linux 10 (based on Ubuntu 20.04)


ADDITIONAL INFORMATION
Running bin/gcompris-qt.sh installed from https://download.kde.org/stable/gcompris/qt/linux/gcompris-qt-3.0-Linux64.sh
Comment 1 Jazeix Johnny 2023-01-19 16:55:07 UTC
I can reproduce, thank you for the report, I'll make a fix
Comment 2 Jazeix Johnny 2023-01-19 17:13:35 UTC
Git commit d7c01f742e1ad318b55ce8c0abe8c495bdcc9b0f by Johnny Jazeix.
Committed on 19/01/2023 at 17:11.
Pushed by jjazeix into branch 'KDE/3.0'.

comparator, fix comparison computation.
Previous code was done using strings and 2 was bigger than 11 because of string comparison...

M  +11   -2    src/activities/comparator/comparator.js

https://invent.kde.org/education/gcompris/commit/d7c01f742e1ad318b55ce8c0abe8c495bdcc9b0f
Comment 3 Jazeix Johnny 2023-01-19 17:13:58 UTC
Git commit e0b8cbfe9faa6b0d09bac5874df7849eea131f03 by Johnny Jazeix.
Committed on 19/01/2023 at 17:12.
Pushed by jjazeix into branch 'master'.

comparator, fix comparison computation.
Previous code was done using strings and 2 was bigger than 11 because of string comparison...

M  +11   -2    src/activities/comparator/comparator.js

https://invent.kde.org/education/gcompris/commit/e0b8cbfe9faa6b0d09bac5874df7849eea131f03
Comment 4 lcerf 2023-01-19 17:29:08 UTC
Your reactivity is always impressive.  Thank you for the fix.  I guess there could be a new activity to compare strings, as in "Would this word be before or after that other word in a dictionary?" (although that would require taking into account the locale!).  ;-)
Comment 5 Jazeix Johnny 2023-01-19 17:37:38 UTC
(In reply to lcerf from comment #4)
> Your reactivity is always impressive.  Thank you for the fix.  I guess there
> could be a new activity to compare strings, as in "Would this word be before
> or after that other word in a dictionary?" (although that would require
> taking into account the locale!).  ;-)

We have activities to order letters, words in a sentence, numbers but not words themselves! It would "just" be creating new datasets.
The translators take care about the locale, as it is when we translate the strings that we ask the strings to be in the correct order.