Moodle
  1. Moodle
  2. MDL-22046

When Attempts grading is set to "Last Attempt", an incomplete exam causes a user's grade to show as zero on some pages.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.9
    • Component/s: SCORM
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      26664

      Description

      With Attempts grading set to Last Attempt, if a user has an incomplete exam, the assessments report page shows that user as having a grade of '0'.

      It's questionable if this is really a "bug", but it was not what our users expected or wanted.

      The fix was to add a function "scorm_get_last_completed_attempt" to mod/scorm/locallib.php, nearly identical to "scorm_get_last_attempt":

      function scorm_get_last_completed_attempt($scormid, $userid) {
      /// Find the last completed attempt number for the given user id and scorm id
      if ($lastattempt = get_record('scorm_scoes_track', 'userid', $userid, 'scormid', $scormid, 'value', 'completed', 'max(attempt) as a')) {
      if (empty($lastattempt->a))

      { return '1'; }

      else

      { return $lastattempt->a; }

      }
      }

      and to change the call to "scorm_get_last_attempt" in the LASTATTEMPT block in the switch statement in scorm_grade_user, to "scorm_get_last_completed_attempt".

        Activity

        Hide
        Dan Marsden added a comment -

        Hi Bruce - great report! - you're right, it makes more sense for the last "completed" attempt to be displayed - I'll get this into Core in the next few days.

        thanks,

        Dan

        Show
        Dan Marsden added a comment - Hi Bruce - great report! - you're right, it makes more sense for the last "completed" attempt to be displayed - I'll get this into Core in the next few days. thanks, Dan
        Hide
        Dan Marsden added a comment -

        finally got to this - fix now in HEAD and 1.9Stable - thanks for the report and patch Bruce!

        Show
        Dan Marsden added a comment - finally got to this - fix now in HEAD and 1.9Stable - thanks for the report and patch Bruce!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: