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

Offline update time not updated correctly by Quiz web services

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.5, 3.3.2, 3.4
    • Fix Version/s: 3.2.6, 3.3.3
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      For this test you will need:

      • A Moodle instance setup to allow Moodle Mobile access
      • The Moodle Mobile App
      • A course, with a quiz setup on it
      • Ensure that the quiz has at least 2 pages with 1 question on each
      • A student who can take the quiz
      • Access to the Moodle database

      Steps:

      1. Login to Moodle as the student on the Mobile app
      2. Navigate to the quiz and start an attempt
      3. Run the following query on the database: 'SELECT * FROM mdl_quiz_attempts' (On MySQL 'SELECT * FROM moodledev.mdl_quiz_attempts ORDER BY id DESC LIMIT 1' will select the most recent attempt only)
      4. Make a note of the timemodified and timemodifiedoffline values for the attempt you have just created.
      5. In the mobile app answer a question and go to the next one
      6. Run the query again, you should see that both the timemodified and timemodifiedoffline values have updated
      7. Answer the next quest and click 'Next' again. Both time stamps should have updated
      8. When you have answered all the questions have been answered Submit and finish, you should see that the timestamps have both been updated again.
      Show
      For this test you will need: A Moodle instance setup to allow Moodle Mobile access The Moodle Mobile App A course, with a quiz setup on it Ensure that the quiz has at least 2 pages with 1 question on each A student who can take the quiz Access to the Moodle database Steps: Login to Moodle as the student on the Mobile app Navigate to the quiz and start an attempt Run the following query on the database: 'SELECT * FROM mdl_quiz_attempts' (On MySQL 'SELECT * FROM moodledev.mdl_quiz_attempts ORDER BY id DESC LIMIT 1' will select the most recent attempt only) Make a note of the timemodified and timemodifiedoffline values for the attempt you have just created. In the mobile app answer a question and go to the next one Run the query again, you should see that both the timemodified and timemodifiedoffline values have updated Answer the next quest and click 'Next' again. Both time stamps should have updated When you have answered all the questions have been answered Submit and finish, you should see that the timestamps have both been updated again.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      When using the save_attempt or process_attempt web service for the quiz activity an E_WARNING is generated similar to:

      E_WARNING: Creating default object from empty value
      in quiz_attempt::set_offline_modified_time called at /var/www/html/mod/quiz/attemptlib.php (2336)in quiz_attempt::set_offline_modified_time called at /var/www/html/mod/quiz/classes/external.php (1249)in mod_quiz_external::process_attempt called at ? (?)in call_user_func_array called at /var/www/html/webservice/lib.php (1353)in webservice_base_server::execute called at /var/www/html/webservice/lib.php (1217)in webservice_base_server::run called at /var/www/html/webservice/rest/server.php (44)

      It is caused by this code:

      // Update the timemodifiedoffline field only if web services are being used.
      if (WS_SERVER) {
          $attemptobj->attempt->timemodifiedoffline = $time;
      }

       

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17