Permalink
Browse files

MDL-42167 Update workshop assessment record only when really changed

Under certain conditions there is nothing to actually update here. The
$DB->update_record() would throw an exception here.
  • Loading branch information...
1 parent 22084d5 commit 22b70ca98529b90d473e66cffd75db90cb0f7fc0 @scara scara committed with mudrd8mz Oct 6, 2013
Showing with 8 additions and 2 deletions.
  1. +4 −1 mod/workshop/assessment.php
  2. +4 −1 mod/workshop/exassessment.php
@@ -188,7 +188,10 @@
if (isset($data->weight) and $cansetassessmentweight) {
$coredata->weight = $data->weight;
}
- $DB->update_record('workshop_assessments', $coredata);
+ // Update the assessment data if there is something other than just the 'id'.
+ if (count((array)$coredata) > 1 ) {
+ $DB->update_record('workshop_assessments', $coredata);
+ }
// And finally redirect the user's browser.
if (!is_null($rawgrade) and isset($data->saveandclose)) {
@@ -126,7 +126,10 @@
// Remember the last one who edited the reference assessment.
$coredata->reviewerid = $USER->id;
}
- $DB->update_record('workshop_assessments', $coredata);
+ // Update the assessment data if there is something other than just the 'id'.
+ if (count((array)$coredata) > 1 ) {
+ $DB->update_record('workshop_assessments', $coredata);
+ }
if (!is_null($rawgrade) and isset($data->saveandclose)) {
if ($canmanage) {

0 comments on commit 22b70ca

Please sign in to comment.