mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
Merge branch 'brokencalc' of git://github.com/andyjdavis/moodle
This commit is contained in:
commit
8f9ae1d5e8
@ -427,3 +427,13 @@ class grade_export_update_buffer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that there is a valid set of grades to export.
|
||||
* @param $courseid int The course being exported
|
||||
*/
|
||||
function export_verify_grades($courseid) {
|
||||
$regraderesult = grade_regrade_final_grades($courseid);
|
||||
if (is_array($regraderesult)) {
|
||||
throw new moodle_exception('gradecantregrade', 'error', '', implode(',', $regraderesult));
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ require_capability('moodle/grade:export', $context);
|
||||
require_capability('gradeexport/ods:view', $context);
|
||||
|
||||
print_grade_page_head($COURSE->id, 'export', 'ods', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_ods'));
|
||||
export_verify_grades($COURSE->id);
|
||||
|
||||
if (!empty($CFG->gradepublishing)) {
|
||||
$CFG->gradepublishing = has_capability('gradeexport/ods:publish', $context);
|
||||
|
@ -34,6 +34,7 @@ require_capability('moodle/grade:export', $context);
|
||||
require_capability('gradeexport/txt:view', $context);
|
||||
|
||||
print_grade_page_head($COURSE->id, 'export', 'txt', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_txt'));
|
||||
export_verify_grades($COURSE->id);
|
||||
|
||||
if (!empty($CFG->gradepublishing)) {
|
||||
$CFG->gradepublishing = has_capability('gradeexport/txt:publish', $context);
|
||||
|
@ -34,6 +34,7 @@ require_capability('moodle/grade:export', $context);
|
||||
require_capability('gradeexport/xls:view', $context);
|
||||
|
||||
print_grade_page_head($COURSE->id, 'export', 'xls', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xls'));
|
||||
export_verify_grades($COURSE->id);
|
||||
|
||||
if (!empty($CFG->gradepublishing)) {
|
||||
$CFG->gradepublishing = has_capability('gradeexport/xls:publish', $context);
|
||||
|
@ -34,6 +34,7 @@ require_capability('moodle/grade:export', $context);
|
||||
require_capability('gradeexport/xml:view', $context);
|
||||
|
||||
print_grade_page_head($COURSE->id, 'export', 'xml', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xml'));
|
||||
export_verify_grades($COURSE->id);
|
||||
|
||||
if (!empty($CFG->gradepublishing)) {
|
||||
$CFG->gradepublishing = has_capability('gradeexport/xml:publish', $context);
|
||||
|
@ -134,7 +134,10 @@ class graded_users_iterator {
|
||||
|
||||
$this->close();
|
||||
|
||||
grade_regrade_final_grades($this->course->id);
|
||||
$regraderesult = grade_regrade_final_grades($this->course->id);
|
||||
if (is_array($regraderesult)) {
|
||||
throw new moodle_exception('gradecantregrade', 'error', '', implode(',', $regraderesult));
|
||||
}
|
||||
$course_item = grade_item::fetch_course_item($this->course->id);
|
||||
if ($course_item->needsupdate) {
|
||||
// can not calculate all final grades - sorry
|
||||
|
@ -244,6 +244,7 @@ $string['filternotinstalled'] = 'Filter {$a} is not currently installed';
|
||||
$string['forumblockingtoomanyposts'] = 'You have exceeded the posting threshold set for this forum';
|
||||
$string['generalexceptionmessage'] = 'Exception - {$a}';
|
||||
$string['gradepubdisable'] = 'Grade publishing disabled';
|
||||
$string['gradecantregrade'] = 'An error occurred during grade calculation: {$a}';
|
||||
$string['groupalready'] = 'User already belongs to group {$a}';
|
||||
$string['groupexistforcourse'] = 'Group "{$a}" already exists for this course';
|
||||
$string['groupexistforcoursewithidnumber'] = '{$a->problemgroup}: Group "{$a->name}" with an idnumber of "{$a->idnumber}" already exists for this course';
|
||||
|
@ -173,6 +173,7 @@ $string['enableoutcomes_help'] = 'Support for Outcomes (also known as Competenci
|
||||
$string['encoding'] = 'Encoding';
|
||||
$string['errorcalculationnoequal'] = 'Formula must start with equal sign (=1+2)';
|
||||
$string['errorcalculationunknown'] = 'Invalid formula';
|
||||
$string['errorcalculationbroken'] = 'Probably circular reference or broken calculation formula';
|
||||
$string['errorgradevaluenonnumeric'] = 'Received non-numeric for low or high grade for';
|
||||
$string['errornocalculationallowed'] = 'Calculations are not allowed for this item';
|
||||
$string['errornocategorisedid'] = 'Could not get an uncategorised id!';
|
||||
|
@ -1097,9 +1097,9 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null)
|
||||
continue; // this one is ok
|
||||
}
|
||||
$grade_items[$gid]->force_regrading();
|
||||
$errors[$grade_items[$gid]->id] = 'Probably circular reference or broken calculation formula'; // TODO: localize
|
||||
$errors[$grade_items[$gid]->id] = get_string('errorcalculationbroken', 'grades');
|
||||
}
|
||||
break; // oki, found error
|
||||
break; // Found error.
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user