Moodle
  1. Moodle
  2. MDL-28718

Block quiz results sometimes sometimes has no access to /mod/quiz/lib.php

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.3
    • Component/s: Blocks, Quiz
    • Labels:
    • Environment:
      Windows iis AND OSX server
    • Testing Instructions:
      Hide

      This only happens when logged in as non-admin. AND it never happens on the first visit to the course page containing the block.
      Logged in as student: go to the course -> no error. Do an activity, and return to the course-page -> get the above error.

      Show
      This only happens when logged in as non-admin. AND it never happens on the first visit to the course page containing the block. Logged in as student: go to the course -> no error. Do an activity, and return to the course-page -> get the above error.
    • Workaround:
      Hide

      I suggest inserting
      require_once $CFG->dirroot.'/mod/quiz/lib.php';
      at line 2 of /blocks/quiz_results/block_quiz_results.php

      Show
      I suggest inserting require_once $CFG->dirroot.'/mod/quiz/lib.php'; at line 2 of /blocks/quiz_results/block_quiz_results.php
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Don't understand why but block quiz results sometimes causes a undefined function error:

      Fatal error: Call to undefined function quiz_format_grade() in /var/www/moodletest/wwwroot/blocks/quiz_results/block_quiz_results.php on line 376

        Gliffy Diagrams

          Activity

          Hide
          Michael de Raadt added a comment -

          Hi, Tim.

          I'm not sure if you're responsible for this block. If not, please assign it to moodle.com.

          Show
          Michael de Raadt added a comment - Hi, Tim. I'm not sure if you're responsible for this block. If not, please assign it to moodle.com.
          Hide
          Tim Hunt added a comment -

          In the past I have always dealt with this block. Not that there have been many problems.

          Show
          Tim Hunt added a comment - In the past I have always dealt with this block. Not that there have been many problems.
          Hide
          Tim Hunt added a comment -

          These changes should fix the problem, but I have not got time to test them properly, especially since we don't use the quiz results block here. If someone could verify that the fix works, I will submit it for integration.

          Note that I did some minor code cleanup (mainly adding boiler-plate comments at the top of files) before fixing the bug.

          Show
          Tim Hunt added a comment - These changes should fix the problem, but I have not got time to test them properly, especially since we don't use the quiz results block here. If someone could verify that the fix works, I will submit it for integration. Note that I did some minor code cleanup (mainly adding boiler-plate comments at the top of files) before fixing the bug.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          +1 or how the hell make one simple include hell difficult to find, lol.

          Show
          Eloy Lafuente (stronk7) added a comment - +1 or how the hell make one simple include hell difficult to find, lol.
          Hide
          Tim Hunt added a comment -
          Show
          Tim Hunt added a comment - You mean like https://github.com/timhunt/moodle/commit/53e91e86880c427bde04d27a377a79e5a990563c Anyway, submitting for integration.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Sam Hemelryk added a comment -

          Thanks Tim - this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Tim - this has been integrated now
          Hide
          Aparup Banerjee added a comment -

          2.1 seems to have version numbers mismatch. (Thanks for the catch Rosie)

          the plugin requires date (2011091600) > version (2011070102.04) , i'm pondering bumping the 2.1 version and bringing the plugin requires version down to the 2.1 version. I'm hoping that theres no reason that the plugin version was so high (unless it wasn't to be backported to 2.1?)

          Show
          Aparup Banerjee added a comment - 2.1 seems to have version numbers mismatch. (Thanks for the catch Rosie) the plugin requires date (2011091600) > version (2011070102.04) , i'm pondering bumping the 2.1 version and bringing the plugin requires version down to the 2.1 version. I'm hoping that theres no reason that the plugin version was so high (unless it wasn't to be backported to 2.1?)
          Hide
          Tim Hunt added a comment -

          Sorry, that was a sloppy back-port. Please change $plugin->requires on the 2.1 branch to match whatever it says in top-level version.php.

          Show
          Tim Hunt added a comment - Sorry, that was a sloppy back-port. Please change $plugin->requires on the 2.1 branch to match whatever it says in top-level version.php.
          Hide
          Aparup Banerjee added a comment - - edited

          thanks, doing so.. and done.

          Show
          Aparup Banerjee added a comment - - edited thanks, doing so.. and done.
          Hide
          Rossiani Wijaya added a comment -

          This is working great.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This is working great. Test passed.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Done, your delicious hacks have been sent upstream, many thanks!

          Closing as fixed, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Done, your delicious hacks have been sent upstream, many thanks! Closing as fixed, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: