Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-48962

lesson maxtime should use a duration form element

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.9
    • 2.7.4, 2.8.2, 2.9
    • Lesson
    • MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_29_STABLE
    • Hide

      Correct installation for new sites

      Verify that when installing a new Moodle website, the lesson table is correctly created with the new timelimit field and no maxtime and timed fields

      Upgrade of existing websites

      • You need an existing website with some lesson some of them timed (Time limit enabled and set to some positive number) and not timed (Time limit not enabled it would be good to have some samples with time limit not enabled and set to a positive value and other with time limit not enabled and set to 0)
      • Make a backup of a course with some lessons prior to upgrade so you can use it later to test restoring it.
      • upgrade the website
      • verify in the database that in the lesson table timed and maxtime fields have been suppressed and timelimit field has been created.
      • verify that for lessons where Time limit wasn't enabled before upgrade, the new timelimit field now has a zero value (whatever the value of the old maxtime was) and that for lesson that were timed before upgrade the value of the new time limit field is 60 times the value of the old maxtime field.
      • verify that when you edit setting of an existing lesson the time limit is correctly displayed

      Creation of a new lesson

      Verify that in the module's form the form element for Time limit is correctly displayed, that the label don't mention an unit, that the help button display a meaningful help, and that the value is correctly saved in the database.

      Attempting of a timed lesson

      Attempt a timed lesson as a student and verify that the "Time left" block is working and that the alerts are correct

      Backup/restore

      Backup a course with some lesson and verify that when restoring it lesson timelimit is correctly preserved in the process

      Compatibility with old backups

      Restore a backup made before this patch and verify that the time limit of lessons is correctly restored and has the right value in seconds

      Show
      Correct installation for new sites Verify that when installing a new Moodle website, the lesson table is correctly created with the new timelimit field and no maxtime and timed fields Upgrade of existing websites You need an existing website with some lesson some of them timed (Time limit enabled and set to some positive number) and not timed (Time limit not enabled it would be good to have some samples with time limit not enabled and set to a positive value and other with time limit not enabled and set to 0) Make a backup of a course with some lessons prior to upgrade so you can use it later to test restoring it. upgrade the website verify in the database that in the lesson table timed and maxtime fields have been suppressed and timelimit field has been created. verify that for lessons where Time limit wasn't enabled before upgrade, the new timelimit field now has a zero value (whatever the value of the old maxtime was) and that for lesson that were timed before upgrade the value of the new time limit field is 60 times the value of the old maxtime field. verify that when you edit setting of an existing lesson the time limit is correctly displayed Creation of a new lesson Verify that in the module's form the form element for Time limit is correctly displayed, that the label don't mention an unit, that the help button display a meaningful help, and that the value is correctly saved in the database. Attempting of a timed lesson Attempt a timed lesson as a student and verify that the "Time left" block is working and that the alerts are correct Backup/restore Backup a course with some lesson and verify that when restoring it lesson timelimit is correctly preserved in the process Compatibility with old backups Restore a backup made before this patch and verify that the time limit of lessons is correctly restored and has the right value in seconds

      Having the setting for "Time limit" using a text form element is not very good UI, it should use a duration element.
      But there are 2 obstacles

      • currently $lesson->maxtime is in minutes not seconds (and if you look in the code there is many places where it is multiplicated by 60 before being used, because minutes is a very bad unit for calculations !)
      • there is a separate boolean setting $lesson->timed to decide whether the lesson is timed or not. Other module use a zero duration value.

      So the question how far should we go about refactoring this area

      • extreme solution : get rid of the minutes unit and decide maxtime is now expressed in seconds, multiply all maxtimes by 60 in the database for existing records during upgrade. Set maxtime = 0 for lessons where timed = false and suppress the timed field. This would allow full use of the duration form element and simplify the code, but will break compatibility.
      • non invasive solution: only use duration element for the UI but in the code do the back and forth conversion to still have maxtime in minutes and timed boolean. This would complicate the code but not break compatibility.

            jmvedrine Jean-Michel Vedrine
            jmvedrine Jean-Michel Vedrine
            Dave Cooper Dave Cooper
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.