Permalink
Browse files

MDL-38149 core_grade: added a guard for when there are no old grades

  • Loading branch information...
1 parent cce0d9a commit ec7298a10fa8d8bb311b026f3b385998fe6eaae3 @andyjdavis andyjdavis committed Feb 26, 2013
Showing with 5 additions and 3 deletions.
  1. +5 −3 grade/report/grader/module.js
@@ -741,9 +741,11 @@ M.gradereport_grader.classes.existingfield = function(ajax, userid, itemid) {
this.editfeedback = ajax.showquickfeedback;
this.grade = this.report.Y.one('#grade_'+userid+'_'+itemid);
- for(var i = 0; i < this.report.grades.length; i++) {
- if (this.report.grades[i]['user']==this.userid && this.report.grades[i]['item']==this.itemid) {
- this.oldgrade = this.report.grades[i]['grade'];
+ if (this.report.grades) {
+ for (var i = 0; i < this.report.grades.length; i++) {
+ if (this.report.grades[i]['user']==this.userid && this.report.grades[i]['item']==this.itemid) {
+ this.oldgrade = this.report.grades[i]['grade'];
+ }
}
}

0 comments on commit ec7298a

Please sign in to comment.