Bug 465661

Summary: Gnumch primes level 8 doesnt accept "23" as a valid prime number and gives error message
Product: [Applications] gcompris Reporter: ReadAlongToLearnEnglish
Component: generalAssignee: Jazeix Johnny <jazeix>
Status: RESOLVED FIXED    
Severity: normal CC: ReadAlongToLearnEnglish
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description ReadAlongToLearnEnglish 2023-02-13 11:12:11 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Launch Gnumch primes
2. Set difficulty level to 8
3. Eat a number "23"

OBSERVED RESULT
Error Message "You ate a wrong number. 23 is divisible by undefined and undefined. Press "Reutrn" or click on me to continue

EXPECTED RESULT
23 should be able to be eaten without error as its a prime number.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma:  20.04 v3.1 downloaded as .sh
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Fix should be able to be made in gnumch-equality.js  / Line 323 by adding 23 to array and incrementing count for for loop Line 324 as it only checks for primes up to 19.
Comment 1 Jazeix Johnny 2023-02-13 11:21:56 UTC
Thank you for the reports.

I think the issue is https://invent.kde.org/education/gcompris/-/blob/master/src/activities/gnumch-equality/gnumch-equality.js#L323 where it misses the 23. The code should be refactor a bit as the array is written in multiple places... I'll make a fix tonight.

Cheers,

Johnny
Comment 2 Jazeix Johnny 2023-02-13 18:10:44 UTC
Git commit 75fb27c91e4829d975a2662403d0ac12abc29398 by Johnny Jazeix.
Committed on 13/02/2023 at 18:08.
Pushed by jjazeix into branch 'master'.

gnumch-primes, 23 is a prime number, refactor the code to fix the issue.

M  +8    -9    src/activities/gnumch-equality/gnumch-equality.js

https://invent.kde.org/education/gcompris/commit/75fb27c91e4829d975a2662403d0ac12abc29398
Comment 3 Jazeix Johnny 2023-02-13 18:11:16 UTC
Git commit 1239336dc765641455fc0c0dda4b00ab22485abe by Johnny Jazeix.
Committed on 13/02/2023 at 18:11.
Pushed by jjazeix into branch 'KDE/3.0'.

gnumch-primes, 23 is a prime number, refactor the code to fix the issue.

M  +8    -9    src/activities/gnumch-equality/gnumch-equality.js

https://invent.kde.org/education/gcompris/commit/1239336dc765641455fc0c0dda4b00ab22485abe