diff --git a/grade/report/user/lib.php b/grade/report/user/lib.php index fc03f1a17fc..d6f1fb57a5d 100644 --- a/grade/report/user/lib.php +++ b/grade/report/user/lib.php @@ -387,7 +387,7 @@ class grade_report_user extends grade_report { * @param $element - An array containing the table data for the current row. */ private function fill_table_recursive(&$element) { - global $DB, $CFG; + global $DB, $CFG, $OUTPUT; $type = $element['type']; $depth = $element['depth']; @@ -577,10 +577,23 @@ class grade_report_user extends grade_report { true); } } else { - $data['grade']['class'] = $class; - $data['grade']['content'] = grade_format_gradevalue($gradeval, - $grade_grade->grade_item, - true); + $gradestatusclass = ''; + $gradepassicon = ''; + $ispassinggrade = $grade_grade->is_passed($grade_grade->grade_item); + if (!is_null($ispassinggrade)) { + $gradestatusclass = $ispassinggrade ? 'gradepass' : 'gradefail'; + if ($ispassinggrade) { + $gradepassicon = $OUTPUT->pix_icon('i/valid', get_string('pass', 'grades'), null, + array('class' => 'inline')); + } else { + $gradepassicon = $OUTPUT->pix_icon('i/invalid', get_string('fail', 'grades'), null, + array('class' => 'inline')); + } + } + + $data['grade']['class'] = "{$class} {$gradestatusclass}"; + $data['grade']['content'] = $gradepassicon . grade_format_gradevalue($gradeval, + $grade_grade->grade_item, true); $gradeitemdata['graderaw'] = $gradeval; } $data['grade']['headers'] = "$header_cat $header_row grade"; diff --git a/grade/report/user/tests/behat/user_view.feature b/grade/report/user/tests/behat/user_view.feature index eb9bef2d334..f7a9080b354 100644 --- a/grade/report/user/tests/behat/user_view.feature +++ b/grade/report/user/tests/behat/user_view.feature @@ -21,11 +21,11 @@ Feature: View the user report as the student will see it | Sub category 1 | C1 | | Sub category 2 | C1 | And the following "activities" exist: - | activity | course | idnumber | name | intro | gradecategory| grade | - | assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 | 100 | - | assign | C1 | a2 | Test assignment two | Submit something! | Sub category 1 | 100 | - | assign | C1 | a3 | Test assignment three | Submit something! | Sub category 2 | 100 | - | assign | C1 | a4 | Test assignment four | Submit something! | Sub category 2 | 100 | + | activity | course | idnumber | name | intro | gradecategory | grade | gradepass | + | assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 | 100 | 50 | + | assign | C1 | a2 | Test assignment two | Submit something! | Sub category 1 | 100 | 50 | + | assign | C1 | a3 | Test assignment three | Submit something! | Sub category 2 | 100 | | + | assign | C1 | a4 | Test assignment four | Submit something! | Sub category 2 | 100 | | And the following "activities" exist: | activity | course | idnumber | name | intro | grade | | assign | C1 | a5 | Test assignment five | Submit something! | 100 | @@ -74,6 +74,8 @@ Feature: View the user report as the student will see it | Sub category 1 total | 33.33 % | - | 0–200 | - | - | | Test assignment five | - | 21.00 | 0–100 | 21.00 % | - | | Course total | - | - | 0–600 | - | - | + And "//i[@aria-label='Pass']" "xpath_element" should exist in the "Test assignment one" "table_row" + And "//i[@aria-label='Fail']" "xpath_element" should exist in the "Test assignment two" "table_row" And the following should not exist in the "user-grade" table: | Grade item | | Test assignment three | @@ -91,6 +93,8 @@ Feature: View the user report as the student will see it | Sub category 1 total | 33.33 % | - | 0–200 | - | - | | Test assignment five | - | 21.00 | 0–100 | 21.00 % | - | | Course total | - | - | 0–600 | - | - | + And "//i[@aria-label='Pass']" "xpath_element" should exist in the "Test assignment one" "table_row" + And "//i[@aria-label='Fail']" "xpath_element" should exist in the "Test assignment two" "table_row" And the following should not exist in the "user-grade" table: | Grade item | | Test assignment three | diff --git a/theme/boost/scss/moodle/grade.scss b/theme/boost/scss/moodle/grade.scss index f58d2840292..82d2946f72f 100644 --- a/theme/boost/scss/moodle/grade.scss +++ b/theme/boost/scss/moodle/grade.scss @@ -52,11 +52,12 @@ } } -.path-grade-report-grader { - span.gradepass { +.path-grade-report-grader, +.path-grade-report-user { + .gradepass { color: $success; } - span.gradefail { + .gradefail { color: $danger; } } diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index 7916c077f9c..6acdfd319df 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -18725,10 +18725,12 @@ p.arrow_button { width: 100%; clear: both; } -.path-grade-report-grader span.gradepass { +.path-grade-report-grader .gradepass, +.path-grade-report-user .gradepass { color: #357a32; } -.path-grade-report-grader span.gradefail { +.path-grade-report-grader .gradefail, +.path-grade-report-user .gradefail { color: #ca3120; } #page-grade-grading-manage #activemethodselector label { diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index a5cd42215bc..95c88fe1682 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -18725,10 +18725,12 @@ p.arrow_button { width: 100%; clear: both; } -.path-grade-report-grader span.gradepass { +.path-grade-report-grader .gradepass, +.path-grade-report-user .gradepass { color: #357a32; } -.path-grade-report-grader span.gradefail { +.path-grade-report-grader .gradefail, +.path-grade-report-user .gradefail { color: #ca3120; } #page-grade-grading-manage #activemethodselector label {