Permalink
Browse files

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

  • Loading branch information...
1 parent 215c189 commit 69313ec4239eb7b9643867d25086201b46f9dbf7 @andyjdavis andyjdavis committed Feb 26, 2013
Showing with 5 additions and 3 deletions.
  1. +5 −3 grade/report/grader/module.js
@@ -740,9 +740,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 69313ec

Please sign in to comment.