add 24 hour format for clock-game
Closed, ResolvedPublic

Description

An supplementary option should be available there not sure how to handle it.
https://en.wikipedia.org/wiki/Date_and_time_representation_by_country
Most countries use 24 hours clock even thought on the clock we only see 0 to 12 on the display.
But english speaking region are using AM PM, we will need to support both.
We could use an option button like we have in gletters to choose between 24 and 12 hours option, or offer for each dataset both format:

full hours (24 hours format)
full hours (12 hours format)

dekumar created this task.Jan 11 2020, 12:50 PM
dekumar claimed this task.
dekumar removed dekumar as the assignee of this task.Feb 12 2020, 7:16 PM

I have taken a look at the code, here is what we can do:

  • we will need to add ActivityConfig, to use an option button for 12 hours system and 24 hours system.
  • we can use the same datasets, as the difference between the 2 systems is only in the displayed hour, and after checking the datasets, the hour isn't controlled via dataset, as in each sublevel, differentTargetH( ) is called.
  • we can change differentTargetH( ) to be as following to support both systems:
  function differentTargetH() {
    items.targetH = Math.floor(Math.random() * 24);
    while(pastQuestionsH.indexOf(items.targetH) != -1) {
        items.targetH = Math.floor(Math.random() * 24);
    }
    pastQuestionsH.push(items.targetH);
    if ( items.twelveSystem ) displayTwelveSysetm();
}
  • differentTargetH( ) is now supporting both systems, we will add a new function to convert the items.targetH form 24-hour system to 12-hour system if it is 12-hour system, else we won't convert it and we will display the items.targetH as it is
function displayTwelveSystem() {
        if( items.targetH > 12 ) {
            items.targetH -= 12;
        }
}
  • Nothing will be changed in differentCurrentH( ) as we aim that items.currentH has a different value from items.targetH
  • for checkAnswer(), we need to call displayTwelveSystem in case of 24-hour system so that we can check if items.targetH equals to items.currentH.

I think nothing else will be modified, to support both systems.
what do you think ?

This looks like a good way to go, thanks!

After checking the result, I have some doubts on the usefulness of displaying AM or PM.
As we display hours from 00:00-12:00 on the clock, what is the interest specifying we want 4PM or 4AM?

Hi,
You are right. Nothing on a pedagogic point of view. AM and PM would only be interesting if we would treat duration type of problems. This is not the case here.

jjazeix moved this task from Backlog to WIP on the GCompris: Improvements board.Feb 16 2021, 7:13 AM
mariamfahmy closed this task as Resolved.Mar 7 2021, 6:12 AM