Moodle
  1. Moodle
  2. MDL-32790

Quiz - Multichoice questions rounding 3 * 33.333 to 99.999 instead of 100

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.13
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      39791

      Description

      When a multi choice question is created with 3 correct answers worth 33.333 each and the user gets all 3 correct, the value stored in mdl_question_states raw_grade and grade should be 1 instead of 0.9999 as this creates inconsistencies when using the data later on (for example the course completion block).
      It is displayed correctly when viewing the 'Summary of your previous attempts' but only because it is rounded at the time of display.

      To reproduce:
      Create a quiz with 1 multi choice question. Allow multiple answers.
      Create 2 wrong answers.
      Create 3 correct answers worth 33.333% each.
      Complete the quiz correctly.

      mdl_question_states raw_grade and grade show non-rounded values which I believe should be rounded. This also effects calculations of the overall quiz grade.

      Suggested solution:
      in grade_responses() in question/type/multichoice/questiontype.php just before the comment '// Make sure we don't assign negative or too high marks' (around line 368) do something along the lines of
      if((int)$state->raw_grade == $state->raw_grade+0.00001)
      $state->raw_grade = $state->raw_grade+0.00001;

        Activity

        Hide
        Tim Hunt added a comment -

        Please update to a more recent version. This was fixed in Moodle 2.0.

        Show
        Tim Hunt added a comment - Please update to a more recent version. This was fixed in Moodle 2.0.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: