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

This commit is contained in:
Andrew Davis
2013-03-03 11:08:37 +08:00
parent cce0d9a100
commit ec7298a10f
+5 -3
View File
@@ -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'];
}
}
}