Moodle
  1. Moodle
  2. MDL-34905

Error received when I click the "save the state of the flags" button

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.3.2
    • Component/s: Quiz
    • Labels:
      None
    • Testing Instructions:
      Hide
      1. Turn of JavaScript in your browser.
      2. Attempt a quiz.
      3. Tick the checkboxes by some flags.
      4. When you get to the review page, click the Save flags button.
      5. Verify that there are no errors, and that the flag state is staved.
      Show
      Turn of JavaScript in your browser. Attempt a quiz. Tick the checkboxes by some flags. When you get to the review page, click the Save flags button. Verify that there are no errors, and that the flag state is staved.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      43431

      Description

      As admin I created a quiz containing a single numeric question. After answering the question I have 2 buttons. "save the state of the flags" and "Finish review". Save the state sends me to the below URL and the page displays the following error.

      /mod/quiz/review.php?attempt=37

      Notice: Undefined variable: DB in /home/andrew/Desktop/code/moodle/int/master/mod/quiz/attemptlib.php on line 1338 Fatal error: Call to a member function start_delegated_transaction() on a non-object in /home/andrew/Desktop/code/moodle/int/master/mod/quiz/attemptlib.php on line 1338

        Issue Links

          Activity

          Hide
          Andrew Davis added a comment -

          In the firefox error console I also get the following when the review page first loads. This is when the page containing the "save the state of the flags" button first loads. Not when I click it.

          Timestamp: 15/08/12 12:18:57
          Error: TypeError: M.core_question_engine is undefined
          Source File: http://localhost/moodle/int/master/lib/javascript.php/1345002270/mod/quiz/module.js
          Line: 1

          Show
          Andrew Davis added a comment - In the firefox error console I also get the following when the review page first loads. This is when the page containing the "save the state of the flags" button first loads. Not when I click it. Timestamp: 15/08/12 12:18:57 Error: TypeError: M.core_question_engine is undefined Source File: http://localhost/moodle/int/master/lib/javascript.php/1345002270/mod/quiz/module.js Line: 1
          Hide
          Dan Poltawski added a comment - - edited

          Wow, the $DB thing looks to be quite old:

          a1eb3a44 (Tim Hunt        2011-02-08 14:19:23 +0000 1337)     public function save_question_flags() {
          34b7d838 (Tim Hunt        2012-04-18 19:18:55 +0100 1338)         $transaction = $DB->start_delegated_transaction();
          a1eb3a44 (Tim Hunt        2011-02-08 14:19:23 +0000 1339)         $this->quba->update_question_flags();
          a1eb3a44 (Tim Hunt        2011-02-08 14:19:23 +0000 1340)         question_engine::save_questions_usage_by_activity($this->quba);
          34b7d838 (Tim Hunt        2012-04-18 19:18:55 +0100 1341)         $transaction->allow_commit();
          a1eb3a44 (Tim Hunt        2011-02-08 14:19:23 +0000 1342)     }
          
          Show
          Dan Poltawski added a comment - - edited Wow, the $DB thing looks to be quite old: a1eb3a44 (Tim Hunt 2011-02-08 14:19:23 +0000 1337) public function save_question_flags() { 34b7d838 (Tim Hunt 2012-04-18 19:18:55 +0100 1338) $transaction = $DB->start_delegated_transaction(); a1eb3a44 (Tim Hunt 2011-02-08 14:19:23 +0000 1339) $ this ->quba->update_question_flags(); a1eb3a44 (Tim Hunt 2011-02-08 14:19:23 +0000 1340) question_engine::save_questions_usage_by_activity($ this ->quba); 34b7d838 (Tim Hunt 2012-04-18 19:18:55 +0100 1341) $transaction->allow_commit(); a1eb3a44 (Tim Hunt 2011-02-08 14:19:23 +0000 1342) }
          Hide
          Tim Hunt added a comment -

          Well, normally, that button is only visible when JS is disabled, and most people have JS on.

          Show
          Tim Hunt added a comment - Well, normally, that button is only visible when JS is disabled, and most people have JS on.
          Hide
          Tim Hunt added a comment -

          Oh, just saw Andrew's second comment. That JS error is a regression caused by MDL-34741. This JS error did not happen before that. I assume you will open another MDL about that.

          Show
          Tim Hunt added a comment - Oh, just saw Andrew's second comment. That JS error is a regression caused by MDL-34741 . This JS error did not happen before that. I assume you will open another MDL about that.
          Hide
          Dan Poltawski added a comment -

          Integrated and tested during integration.

          Show
          Dan Poltawski added a comment - Integrated and tested during integration.
          Hide
          Dan Poltawski added a comment -

          (the js has been addressed by failing the original issue)

          Show
          Dan Poltawski added a comment - (the js has been addressed by failing the original issue)
          Hide
          Eloy Lafuente (stronk7) added a comment -

          For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility!

          Many thanks for your collaboration, yay!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility! Many thanks for your collaboration, yay! Closing, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: