Skip to content
Browse files

MDL-36167: Update all users in assignment quickgrade form to ensure f…

…eedback is saved
  • Loading branch information...
1 parent 6812769 commit a13a1707bc363fffb332af0cccf10f38cd9216f9 @luke-tucker luke-tucker committed with danpoltawski Nov 9, 2012
Showing with 10 additions and 12 deletions.
  1. +10 −12 mod/assign/locallib.php
View
22 mod/assign/locallib.php
@@ -3448,19 +3448,16 @@ private function process_save_quick_grades() {
// gets a list of possible users and look for values based upon that.
foreach ($participants as $userid => $unused) {
$modified = optional_param('grademodified_' . $userid, -1, PARAM_INT);
- if ($modified >= 0) {
- // gather the userid, updated grade and last modified value
- $record = new stdClass();
- $record->userid = $userid;
+ // gather the userid, updated grade and last modified value
+ $record = new stdClass();
+ $record->userid = $userid;
+ $gradevalue = optional_param('quickgrade_' . $userid, '', PARAM_TEXT);
+ if($modified >= 0) {
$record->grade = unformat_float(required_param('quickgrade_' . $record->userid, PARAM_TEXT));
- $record->lastmodified = $modified;
- $record->gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, array($userid));
- $users[$userid] = $record;
}
- }
- if (empty($users)) {
- // Quick check to see whether we have any users to update and we don't
- return get_string('quickgradingchangessaved', 'assign'); // Technical lie
+ $record->lastmodified = $modified;
+ $record->gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, array($userid));
+ $users[$userid] = $record;
}
list($userids, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED);
@@ -3494,7 +3491,8 @@ private function process_save_quick_grades() {
foreach ($this->feedbackplugins as $plugin) {
if ($plugin->is_visible() && $plugin->is_enabled() && $plugin->supports_quickgrading()) {
if ($plugin->is_quickgrading_modified($modified->userid, $grade)) {
- if ((int)$current->lastmodified > (int)$modified->lastmodified) {
+ if ($modified->lastmodified >= 0 &&
+ (int)$current->lastmodified > (int)$modified->lastmodified) {
return get_string('errorrecordmodified', 'assign');
} else {
$modifiedusers[$modified->userid] = $modified;

0 comments on commit a13a170

Please sign in to comment.
Something went wrong with that request. Please try again.