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

Allowing multianwer (Cloze) question to have a 0 default grade as other question types

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Inactive
    • Affects Version/s: 1.9.4, 2.0
    • Fix Version/s: None
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      The default grade of question in multianwer (Cloze) question type cannot be zero in the actual code.
      See http://moodle.org/mod/forum/discuss.php?d=113387
      The following changes solve the problem

      @@ -984,8 +984,11 @@
      ; preg_match('/'.ANSWER_REGEX.'/', $question->questiontext, $answerregs)
      ; ++$positionkey ) {
      $wrapped = new stdClass;

      • $wrapped->defaultgrade = $answerregs[ANSWER_REGEX_NORM]
      • or $wrapped->defaultgrade = '1';
        + if (isset($answerregs[ANSWER_REGEX_NORM]) && $answerregs[ANSWER_REGEX_NORM]!== '') { + $wrapped->defaultgrade = $answerregs[ANSWER_REGEX_NORM]; + }

        else

        { + $wrapped->defaultgrade = '1'; + }

        if (!empty($answerregs[ANSWER_REGEX_ANSWER_TYPE_NUMERICAL])) {
        $wrapped->qtype = 'numerical';
        $wrapped->multiplier = array();

      Should be CVS soon after some more testing

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            ppichet Pierre Pichet
            Participants:
            Component watchers:
            Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: