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

Javascript error in submission_outcome() function of module.js

XMLWordPrintable

      Hi,
      While creating a custom grader report, I found a minor oversight in the M.gradereport_grader.classes.ajax.prototype.submission_outcome() function in grade\report\grader\module.js has a Javascript error in the catch block of the function:
      <snip>
      message.replace(/[1]/, args.type);
      message.replace(/[2]/, M.gradereport_grader.users[args.properties.userid]);
      </snip>
      The error is only visible when AJAX is enabled for the grader report and the ajax_callbacks.php has an error in it.
      The replace method doesn't assign the result its parent object(message in this case) - it needs to be assigned to a variable like:
      <snip>
      message = message.replace(/[1]/, args.type);
      message = message.replace(/[2]/, this.report.users[args.properties.userid]);
      </snip>

      In addition, M.gradereport_grader.users[] is empty, so we need to use the "this" reference.

      I've attached a patch file that resolves the problem as shown above.

      Cheers,
      Andy

            moodle.com Moodle HQ
            andrew.zoltay@royalroads.ca Andrew Zoltay
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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