Skip to content

Commit

Permalink
MDL-55821 assign: Show assign grade
Browse files Browse the repository at this point in the history
When marking workflow is enabled and the grade is not released yet,
it would be helpful to show the assignment grade in the grading form.
  • Loading branch information
Damyon Wiese committed Jun 6, 2019
1 parent 124ac3b commit 3a37d96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions mod/assign/lang/en/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
$string['couldnotcreatecoursemodule'] = 'Could not create course module.';
$string['couldnotcreatenewassignmentinstance'] = 'Could not create new assignment instance.';
$string['couldnotfindassignmenttoupgrade'] = 'Could not find old assignment instance to upgrade.';
$string['currentassigngrade'] = 'Current grade in assignment';
$string['currentgrade'] = 'Current grade in gradebook';
$string['currentattempt'] = 'This is attempt {$a}.';
$string['currentattemptof'] = 'This is attempt {$a->attemptnumber} ( {$a->maxattempts} attempts allowed ).';
Expand Down
9 changes: 9 additions & 0 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7406,6 +7406,14 @@ public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data,
$options = array('' => get_string('markingworkflowstatenotmarked', 'assign')) + $states;
$mform->addElement('select', 'workflowstate', get_string('markingworkflowstate', 'assign'), $options);
$mform->addHelpButton('workflowstate', 'markingworkflowstate', 'assign');
$gradingstatus = $this->get_grading_status($userid);
if ($gradingstatus != ASSIGN_MARKING_WORKFLOW_STATE_RELEASED) {
if ($grade->grade && $grade->grade != -1) {
$assigngradestring = html_writer::span(grade_floatval($grade->grade), 'currentgrade');
$label = get_string('currentassigngrade', 'assign');
$mform->addElement('static', 'currentassigngrade', $label, $assigngradestring);
}
}
}

if ($this->get_instance()->markingworkflow &&
Expand All @@ -7427,6 +7435,7 @@ public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data,
$mform->disabledIf('allocatedmarker', 'workflowstate', 'eq', ASSIGN_MARKING_WORKFLOW_STATE_READYFORRELEASE);
$mform->disabledIf('allocatedmarker', 'workflowstate', 'eq', ASSIGN_MARKING_WORKFLOW_STATE_RELEASED);
}

$gradestring = '<span class="currentgrade">' . $gradestring . '</span>';
$mform->addElement('static', 'currentgrade', get_string('currentgrade', 'assign'), $gradestring);

Expand Down

0 comments on commit 3a37d96

Please sign in to comment.