mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-69956 forum: throw exception when advanced grading is not ready
This commit is contained in:
parent
a5f0b354e7
commit
9e1dacc3c6
@ -156,6 +156,9 @@ class fetch extends external_api {
|
||||
$hasgrade = $gradeitem->user_has_grade($gradeduser);
|
||||
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
|
||||
$instance = $gradeitem->get_advanced_grading_instance($USER, $grade);
|
||||
if (!$instance) {
|
||||
throw new moodle_exception('error:gradingunavailable', 'grading');
|
||||
}
|
||||
$controller = $instance->get_controller();
|
||||
$definition = $controller->get_definition();
|
||||
$fillings = $instance->get_guide_filling();
|
||||
|
@ -149,6 +149,10 @@ class fetch extends external_api {
|
||||
$hasgrade = $gradeitem->user_has_grade($gradeduser);
|
||||
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
|
||||
$instance = $gradeitem->get_advanced_grading_instance($USER, $grade);
|
||||
if (!$instance) {
|
||||
throw new moodle_exception('error:gradingunavailable', 'grading');
|
||||
}
|
||||
|
||||
$controller = $instance->get_controller();
|
||||
$definition = $controller->get_definition();
|
||||
$fillings = $instance->get_rubric_filling();
|
||||
|
@ -95,3 +95,4 @@ $string['templatetypeown'] = 'Own form';
|
||||
$string['templatetypeshared'] = 'Shared template';
|
||||
$string['templatesource'] = 'Location: {$a->component} ({$a->area})';
|
||||
$string['error:notinrange'] = 'Invalid grade \'{$a->grade}\' provided. Grades must be between 0 and {$a->maxgrade}.';
|
||||
$string['error:gradingunavailable'] = 'The advanced grading method is not correctly set. Please check the whole forum grading options in the forum settings.';
|
||||
|
Loading…
x
Reference in New Issue
Block a user