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

grade_update_outcomes() never returns a value (+ fix)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.9.10
    • 1.9.9
    • Gradebook
    • None
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

      This makes it very difficult to develop extensions that save outcomes to the gradebook as it is impossible to know if the save has occurred properly.

      here's a working version:

      function grade_update_outcomes($source, $courseid, $itemtype, $itemmodule, $iteminstance, $userid, $data) {
          if ($items = grade_item::fetch_all(array('itemtype'=>$itemtype, 'itemmodule'=>$itemmodule, 'iteminstance'=>$iteminstance, 'courseid'=>$courseid))) {
              $errors = false;
              foreach ($items as $item) {
                  if (!array_key_exists($item->itemnumber, $data)) {
                      continue;
                  }
                  $grade = $data[$item->itemnumber] < 1 ? null : $data[$item->itemnumber];
                  $errors = ($item->update_final_grade($userid, $grade, $source)) ? $errors : true;
              }
              return $errors;
          }
          return false;
      }

            andyjdavis Andrew Davis
            mattgibson Matt Gibson (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.