Moodle
  1. Moodle
  2. MDL-21111

Quiz duration is reported in years if Time Finish is before Time Start

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7
    • Fix Version/s: 1.9.10
    • Component/s: Quiz
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      24663

      Description

      I have tested in 1.9.7 and this is still an issue. So I have fixed this in quiz/review.php and quiz/overview/report.php to report a "-" if quiz timefinish is before timestart.

        Issue Links

          Activity

          Hide
          Tim Lock added a comment -

          This is a patch is to change the mod/quiz/db/install.xml so that timestart / timefinish fields are signed because MySQL returning 18446744073709551615 for the duration when timestart is 1256188654 and timeend is 1256188653.

          With the database changes in MySQL, it returns 1 and the patch shows "" next to the result because timefinish < timestart.

          Show
          Tim Lock added a comment - This is a patch is to change the mod/quiz/db/install.xml so that timestart / timefinish fields are signed because MySQL returning 18446744073709551615 for the duration when timestart is 1256188654 and timeend is 1256188653. With the database changes in MySQL, it returns 1 and the patch shows " " next to the result because timefinish < timestart.
          Hide
          Tim Lock added a comment -

          Alternatively, you can cast the timestart / timefinish to be signed will fix the SQL as below :-

          mysql> select cast(timefinish as signed) - cast(timestart as signed) as duration from mdl_quiz_attempts where id = 3543;
          ----------

          duration

          ----------

          -1

          ----------
          1 row in set (0.00 sec)

          Show
          Tim Lock added a comment - Alternatively, you can cast the timestart / timefinish to be signed will fix the SQL as below :- mysql> select cast(timefinish as signed) - cast(timestart as signed) as duration from mdl_quiz_attempts where id = 3543; ---------- duration ---------- -1 ---------- 1 row in set (0.00 sec)
          Hide
          Tim Hunt added a comment -

          The only thing is that SQL is Moodle has to work on all supported database.

          Show
          Tim Hunt added a comment - The only thing is that SQL is Moodle has to work on all supported database.
          Hide
          Tim Hunt added a comment -

          Added UI Mockup: <2010-02-03 18:29>

          Show
          Tim Hunt added a comment - Added UI Mockup: <2010-02-03 18:29>
          Hide
          Tim Hunt added a comment -

          Amusingly, that many seconds is approximately 42 time the age of the universe, which must be significant

          Anyway, I have 'fixed' this by doing the subtraction in Moodle, and format_time does abs() on its input, so the problem will go away.

          Of course, the real problem is servers with badly synchronised clocks. Server admins really ought to fix that.

          Show
          Tim Hunt added a comment - Amusingly, that many seconds is approximately 42 time the age of the universe, which must be significant Anyway, I have 'fixed' this by doing the subtraction in Moodle, and format_time does abs() on its input, so the problem will go away. Of course, the real problem is servers with badly synchronised clocks. Server admins really ought to fix that.

            People

            • Assignee:
              Tim Hunt
              Reporter:
              Tim Lock
              Tester:
              Nobody
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: