Permalink
Browse files

MDL-31919 Fix assignment overview output to respect gradebook grading.

Currenly, if assigment has been graded in gradebook only, in the assigment
overview it is listed as not graded.
  • Loading branch information...
1 parent 5bbf3cb commit 8ef93c7029202e6b952687c3b1f7a09a4029c855 Ruslan Kabalin committed Mar 6, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 mod/assignment/lib.php
View
8 mod/assignment/lib.php
@@ -3612,6 +3612,7 @@ function assignment_types() {
function assignment_print_overview($courses, &$htmlarray) {
global $USER, $CFG, $DB;
+ require_once($CFG->libdir.'/gradelib.php');
if (empty($courses) || !is_array($courses) || count($courses) == 0) {
return array();
@@ -3680,6 +3681,9 @@ function assignment_print_overview($courses, &$htmlarray) {
assignment $sqlassignmentids", array_merge(array($USER->id), $assignmentidparams));
foreach ($assignments as $assignment) {
+ $grading_info = grade_get_grades($assignment->course, 'mod', 'assignment', $assignment->id, $USER->id);
+ $final_grade = $grading_info->items[0]->grades[$USER->id];
+
$str = '<div class="assignment overview"><div class="name">'.$strassignment. ': '.
'<a '.($assignment->visible ? '':' class="dimmed"').
'title="'.$strassignment.'" href="'.$CFG->wwwroot.
@@ -3713,9 +3717,9 @@ function assignment_print_overview($courses, &$htmlarray) {
$submission = $mysubmissions[$assignment->id];
- if ($submission->teacher == 0 && $submission->timemarked == 0) {
+ if ($submission->teacher == 0 && $submission->timemarked == 0 && !$final_grade->grade) {
$str .= $strsubmitted . ', ' . $strnotgradedyet;
- } else if ($submission->grade <= 0) {
+ } else if ($submission->grade <= 0 && !$final_grade->grade) {
$str .= $strsubmitted . ', ' . $strreviewed;
} else {
$str .= $strsubmitted . ', ' . $strgraded;

0 comments on commit 8ef93c7

Please sign in to comment.