Add multiple dataset in guessnumber activity
ClosedPublic

Authored by sambhavkaul on Dec 23 2019, 8:33 PM.

Details

Summary

The dataset has been added as mentioned here https://phabricator.kde.org/T12422

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
sambhavkaul created this revision.Dec 23 2019, 8:33 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptDec 23 2019, 8:33 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
sambhavkaul edited the summary of this revision. (Show Details)Dec 23 2019, 8:36 PM
sambhavkaul edited the summary of this revision. (Show Details)Dec 23 2019, 8:44 PM

Hi,
Excellent work!
Just a point, in config display the menu are not exclusive, I can select option 1 and option 2. It could be good when I select option 2 that option 1 would be disabled.
Also I have an error message that was I think not there before
qrc:/gcompris/src/activities/guessnumber/AnswerArea.qml:69: TypeError: Cannot read property 'maxNumber' of undefined
Could you have a look please?
Also, let choose
MultipleData4: Recommended age: 9-10
max number 1 000 000.
Could you try to find a way to group numbers when you diplay them by three.
Exemple: 250 000 instead of 250000 which is too difficult to read even for an adult.
Emmanuel

Hi @echarruau ,
Made the following changes:

  1. config menu display updated
  2. error message removed
  3. Added spaces between group of 3 in display text using regex so that it is easily readable

Please see to it now.
Thanks

Just a point, in config display the menu are not exclusive, I can select option 1 and option 2. It could be good when I select option 2 that option 1 would be disabled.

We added this possibility in the whole multiple dataset, it's to be able to select multiple levels. If you think on some activities they should be exclusive, let's discuss it in https://phabricator.kde.org/M146/541/

src/activities/guessnumber/AnswerArea.qml
71

remove the added space at the end

src/activities/guessnumber/Guessnumber.qml
173

remove added space

src/activities/guessnumber/guessnumber.js
71

add a comment to specify what this line does, the name of the function is not relevant enough to understand what it does.

Why not directly use the Qt function to do this (https://doc.qt.io/qt-5/qml-qtqml-number.html)?

src/activities/guessnumber/resource/1/Data.qml
31

is this attribute really useful?

32

can you replace all of these with:

//: first number is the minimum number and second the maximum number
qsTr("Guess a number between %1 and %2").arg(1).arg(25)?

This way, translators will only have one string to translate and this could avoid a lot of typo.

What would be the best (but not sure if it works) would be to be able to use the minNumber/maxNumber directly, something like:

qsTr("Guess a number between %1 and %2").arg(minNumber).arg(maxNumber)
56

add a newline at the end of the file

sambhavkaul added inline comments.Dec 26 2019, 2:11 PM
src/activities/guessnumber/guessnumber.js
71

Hi @jjazeix ,

By using the Qt function it by default shows '0' in user entry text box at the beginning and the '0' gets overwrites when we type. So, there is always a zero at beginning. And it gives output with commas instead of spaces after a group of 3 digits. So if you allow should I go with the Qt function or let it be with the js function ?

Thanks

src/activities/guessnumber/resource/1/Data.qml
32

Hi, @jjazeix

Should I use

qsTr("Guess a number between %1 and %2").arg(minNumber).arg(maxNumber)

in js file as min and maxNumber can be accessed from there and also then there will be no use of objective and we can delete the objective attribute as well and instead of hard coding the values of max and min in data file it will be easier. Should I do this ?

Thanks

jjazeix added inline comments.Dec 26 2019, 2:23 PM
src/activities/guessnumber/guessnumber.js
71

It gives comma because you are using a locale that uses commas as separator. It should use the same locale as GCompris.
For the initial zero, can't you do a check on the string's emptiness?

src/activities/guessnumber/resource/1/Data.qml
32

No, the aim is to have the objectives in the Data.qml files by dataset directly. The final goal of multiple dataset will be to be able to directly load new datasets dynamically without having to compile again the application so we don't want them in the js directly.
If it is not possible directly in the Data.qml, let's keep it this way.

jjazeix added inline comments.Dec 26 2019, 2:33 PM
src/activities/guessnumber/guessnumber.js
46

trailing spaces

When starting the activity: qrc:/gcompris/src/activities/guessnumber/Guessnumber.qml:63: TypeError: Cannot read property 'data' of null
When changing level in configuration: qrc:/gcompris/src/activities/guessnumber/Guessnumber.qml:144: Error: Cannot assign to non-existent property "currentLevel"

sambhavkaul marked 4 inline comments as done.

Hi,
Updated the patch, following are the updates:

  1. Corrections as mentioned in comments are done
  2. Numerical suite has been added for multiple dataset 1, age 5 - 6
  3. The dataset has been updated as mention by @echarruau here https://phabricator.kde.org/T12422

Thanks

sambhavkaul edited the summary of this revision. (Show Details)Dec 27 2019, 6:27 PM

Please fix the following errors:
qrc:/gcompris/src/activities/guessnumber/Guessnumber.qml:65: TypeError: Cannot read property 'difficulty' of null
qrc:/gcompris/src/activities/guessnumber/Guessnumber.qml:64: TypeError: Cannot read property 'data' of null
qrc:/gcompris/src/activities/guessnumber/Guessnumber.qml:183: Error: Cannot assign to non-existent property "currentLevel"

src/activities/guessnumber/AnswerArea.qml
73 ↗(On Diff #72119)

you have to use the locale used in GCompris, not the one of the computer

src/activities/guessnumber/Guessnumber.qml
65 ↗(On Diff #72119)

it's an integer so it's better to declare it as integer than var

129 ↗(On Diff #72119)

indentation

134 ↗(On Diff #72119)

It should be dependent on the dataset max value (and handle well the scale), not hardcoded.
Maybe it would be nice to only have a max number of displayed values (5 or 10) and round, for example for first dataset, and the plane moves accordingly:

05101520
137 ↗(On Diff #72119)

this does not scale well (if you have a small screen, you don't see the last numbers)

145 ↗(On Diff #72119)

indentation

149 ↗(On Diff #72119)

indentation + use GCText for texts (to have the good font used)

src/activities/guessnumber/guessnumber.js
48 ↗(On Diff #72119)

make the visibility of the item a variable of the dataset, we don't want hardcode depending on the dataset in the common code

sambhavkaul added inline comments.Dec 27 2019, 8:03 PM
src/activities/guessnumber/Guessnumber.qml
134 ↗(On Diff #72119)

Suppose we have our first dataset as

  1. 1 - 10
  2. 1 - 15
  3. 1 - 20

So it should display only max number of displayed numbers means 10 in 1 - 10 level or numbers till 10 or 10 15 20 should be displayed on every level ?

jjazeix added inline comments.Dec 27 2019, 8:06 PM
src/activities/guessnumber/Guessnumber.qml
134 ↗(On Diff #72119)

the max should be the maximum of the question, not the dataset (so 10, 15, 20 for your example).

sambhavkaul added inline comments.Dec 27 2019, 8:14 PM
src/activities/guessnumber/Guessnumber.qml
134 ↗(On Diff #72119)

so 10 15 20 as in the example should be displayed on all the levels(i.e 3 levels for first dataset) ? But then what is the need of displaying these to every level ? allon suggested that the suite should contain numbers from which the child can take help.

I have several problems.

  • I can not see the numerical suite.
  • When I choose "guess a number between 1 and 100" and "guess a number between 1 and 20", if I save it then go back to the settings, unselect "guess a number between 1 and 100", I still have the levels up to 100.

Hi,

I think the error problems is with the branch as mentioned here https://phabricator.kde.org/D26278. Other than that I have made the changes as suggested in comments.

  1. The numerical suite should be visible now but as for now it is hardcoded till number 20 for dataset 1. As Johnny was suggesting to put only max values , so further discussion in needed as mentioned here https://phabricator.kde.org/D26196#inline-147847
  2. Data has been updated as suggested

Thanks

jjazeix added inline comments.Jan 4 2020, 8:28 PM
src/activities/guessnumber/AnswerArea.qml
71 ↗(On Diff #72119)

why not keeping the binding?

src/activities/guessnumber/Guessnumber.qml
140 ↗(On Diff #72119)

indentation

152 ↗(On Diff #72119)

indentation

src/activities/guessnumber/guessnumber.js
46–49 ↗(On Diff #72119)

there is no need to check it there, you already access it before so if it is undefined, it will "crash" before

src/activities/guessnumber/resource/1/Data.qml
23 ↗(On Diff #72119)

the imports of QtQuick and GCompris are not needed, you can remove them

Hi, @jjazeix

I have made the changes as per the comments above.
Also please tell what should be added in numerical suite, the largest numbers of the level or the numbers from 1 to 20 as discussed here https://phabricator.kde.org/D26196#inline-147847 ?

Thanks

sambhavkaul updated this revision to Diff 72796.Jan 5 2020, 1:49 PM

After discussion with @echarruau :

  • can you do a first diff with only the dataset (just remove the numerical suite, keep the other features) that we can integrate directly. Having the separator on high numbers is a great addition.
  • for the numerical suite, in a second time, instead of having it on one line, having the numbers on 2 lines (so 0 to 9 and 10 to 19) should be better. Centering it on the background should be enough to have all the numbers displayed. It is still not clear if we only have the numerical suite for the first level or if we will need adaptation for higher levels...

Thank you

jjazeix added inline comments.Jan 25 2020, 3:06 PM
src/activities/guessnumber/resource/3/Data.qml
26 ↗(On Diff #72119)

can you also put here qsTr("Guess a number between 1 and %1").arg(1000) and improve it so digits are also grouped by 3 depending on locale? This way we are coherent in both the questions and answers

sambhavkaul marked an inline comment as done.

Hi, @jjazeix

I have updated the first diff as said without the numerical suite and made the changes mentioned in comment. Please see to it now. I will upload the second diff with numerical suite after this.

Thank you

jjazeix added inline comments.Jan 28 2020, 6:16 PM
src/activities/guessnumber/AnswerArea.qml
70 ↗(On Diff #72119)

There is still this thing that I'd like to be fixed.
By removing the binding on "text: answerBackground.userEntry", it does not reset the plane at the end of the level to the screen.
Putting back the binding almost works fine, but there are issues when typing 0 that should be ignored if the answer if empty (if you type 0 twice at first level, you can't erase the actual number by typing 2 for example).
Can you take a look at this?

Tested, indeed last think to fix is the reset of the position of the helicopter.
Otherwise it works good.

sambhavkaul updated this revision to Diff 75013.Feb 4 2020, 8:13 PM
sambhavkaul marked an inline comment as done.

Hi,

I have updated the diff with helico getting reset on every level. Please see to it now.

Thanks

Tested again, now it looks ok for me, all work as expected.

jjazeix accepted this revision.Feb 5 2020, 7:42 PM
This revision is now accepted and ready to land.Feb 5 2020, 7:42 PM