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

Refactor all the code that implements the rules for whether students can attempt the quiz now into some classes

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.9
    • 2.0
    • Quiz
    • None
    • MOODLE_19_STABLE
    • MOODLE_20_STABLE

    Description

      There are millions of if statements in view.php and attempt.php and review.php to enforce the various rules about when students can attempt the quiz. This is messy, it makes the logic hard to follow, and there are often bugs where the logic to implement a particular rule is not exactly the same in different places.

      The plan is to refactor all this code into some classes. There is a main class quiz_access_manager, which is the only one that view.php, attempt.php, etc. have to talk to.

      Internally, it uses a number of small classes derived from quiz_access_rule_base which each encapsulate a particular rule. For example, there will be a open_close_date_access_rule, a time_limit_access_rule, and so on. Thus, all the logic for a particular rule is in just one place, and therefore, hopefully, consistent.

      Attachments

        Activity

          People

            timhunt Tim Hunt
            timhunt Tim Hunt
            Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              24/Nov/10