This commit is contained in:
David Monllao 2017-05-22 10:41:46 +08:00
commit a5906ac944

View File

@ -4862,17 +4862,19 @@ class assign {
}
$cangrade = has_capability('mod/assign:grade', $this->get_context());
$hasgrade = $this->get_instance()->grade != GRADE_TYPE_NONE &&
!is_null($gradebookgrade) && !is_null($gradebookgrade->grade);
$gradevisible = $cangrade || $this->get_instance()->grade == GRADE_TYPE_NONE ||
(!is_null($gradebookgrade) && !$gradebookgrade->hidden);
// If there is a visible grade, show the summary.
if (!is_null($gradebookgrade) && (!is_null($gradebookgrade->grade) || !$emptyplugins)
&& ($cangrade || !$gradebookgrade->hidden)) {
if (($hasgrade || !$emptyplugins) && $gradevisible) {
$gradefordisplay = null;
$gradeddate = null;
$grader = null;
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
// Only show the grade if it is not hidden in gradebook.
if (!is_null($gradebookgrade->grade) && ($cangrade || !$gradebookgrade->hidden)) {
if ($hasgrade) {
if ($controller = $gradingmanager->get_active_controller()) {
$menu = make_grades_menu($this->get_instance()->grade);
$controller->set_grade_range($menu, $this->get_instance()->grade > 0);