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 794391b commit 46f7f67
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
Expand Up @@ -131,6 +131,7 @@
$string['couldnotcreatenewassignmentinstance'] = 'Could not create new assignment instance.';
$string['couldnotfindassignmenttoupgrade'] = 'Could not find old assignment instance to upgrade.';
$string['crontask'] = 'Background processing for assignment module';
$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
Expand Up @@ -7585,6 +7585,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 @@ -7606,6 +7614,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 46f7f67

Please sign in to comment.