Bug 501140

Summary: Too small amount of money in change-money exercise availlable
Product: [Applications] gcompris Reporter: ulrich.lintl
Component: generalAssignee: Jazeix Johnny <jazeix>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot of exercise with too little money to pay

Description ulrich.lintl 2025-03-06 11:29:22 UTC
Created attachment 179176 [details]
Screenshot of exercise with too little money to pay

SUMMARY
In the German version of the exercise "Give Tux his change, including cents" you can see in the screenshot, that the overall price of the goods is 7,15 €. But the maximum amount available, you can select, is 7,09 €. So with this bug, the exercise is unsolveable.

The error has occured at level 4 of this exercise.
Though being a clear error evidenced with a screenshot, it was not reproducable.
Nevertheless, there must be a flaw, maybe in the calculation algorithm

STEPS TO REPRODUCE
-

OBSERVED RESULT
Only 7,09 € are availlable in the excercises money-pool, while the demanded overall-amount is 7,15 €

EXPECTED RESULT
That at least the same amount demanded was available in the money-pool, so at least 7,15 € here

SOFTWARE/OS VERSIONS
Software:
GCompris for Linux, Version 4.3

OS:
Linux --> Debian-based distro Emmabuntüs, Version DE5 1.03


ADDITIONAL INFORMATION
Comment 1 Jazeix Johnny 2025-03-06 19:29:08 UTC
Hi,
thank you for the report and the screenshot. After a first look at the code (https://invent.kde.org/education/gcompris/-/blob/38c10a39ee02ba41a1c61c1f37b25e3d189a13a4/src/activities/money_cents/resource/1/Data.qml#L76-91), the max price for the items should have been 7, I'll dig more to understand how it was possible to have more than this.
Comment 2 Jazeix Johnny 2025-03-06 20:25:13 UTC
Git commit 42943efed5bc22068d46638ac501550e659ef1f3 by Johnny Jazeix.
Committed on 06/03/2025 at 20:23.
Pushed by jjazeix into branch 'master'.

money_with_cents, make sure we are not above the maximum

M  +6    -0    src/activities/money/money.js

https://invent.kde.org/education/gcompris/-/commit/42943efed5bc22068d46638ac501550e659ef1f3
Comment 3 Jazeix Johnny 2025-03-06 20:25:51 UTC
Git commit 50e341697bfe8caf8a6b6cd74d486354d2bf1477 by Johnny Jazeix.
Committed on 06/03/2025 at 20:24.
Pushed by jjazeix into branch 'KDE/25.0'.

money_with_cents, make sure we are not above the maximum

M  +6    -0    src/activities/money/money.js

https://invent.kde.org/education/gcompris/-/commit/50e341697bfe8caf8a6b6cd74d486354d2bf1477
Comment 4 Jazeix Johnny 2025-03-06 20:28:11 UTC
The issue was with the algorithm indeed, we managed to have more than the maximum if the first items were less than 2, but with higher cents than the last one and the last one was the maximum value remaining.
Comment 5 ulrich.lintl 2025-03-07 12:52:12 UTC
A big Tank-You to you, Johnny, for for proper reaction!
Comment 6 animtim 2025-03-11 11:53:21 UTC
Git commit 87e74e743311bb41b34f1a18cb995a5182fd0bf7 by Timothée Giet, on behalf of Johnny Jazeix.
Committed on 10/03/2025 at 09:49.
Pushed by jjazeix into branch 'KDE/4.0'.

money_with_cents, make sure we are not above the maximum

M  +6    -0    src/activities/money/money.js

https://invent.kde.org/education/gcompris/-/commit/87e74e743311bb41b34f1a18cb995a5182fd0bf7