Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-29336-numerrors-mapping-20_STABLE' of git://github.…

…com/mudrd8mz/moodle into MOODLE_20_STABLE
  • Loading branch information...
commit 5ea58ff4e14a6454e9fa0cce41062e0e4d413228 2 parents 3603e08 + c418df9
@samhemelryk samhemelryk authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 mod/workshop/form/numerrors/lib.php
View
6 mod/workshop/form/numerrors/lib.php
@@ -164,6 +164,7 @@ public function save_edit_strategy_form(stdclass $data) {
$records = $data->numerrors; // data to be saved into {workshopform_numerrors}
$mappings = $data->mappings; // data to be saved into {workshopform_numerrors_map}
$todelete = array(); // dimension ids to be deleted
+ $maxnonegative = 0; // maximum number of (weighted) negative responses
for ($i=0; $i < $norepeats; $i++) {
$record = $records[$i];
@@ -181,6 +182,7 @@ public function save_edit_strategy_form(stdclass $data) {
// exiting field
$DB->update_record('workshopform_numerrors', $record);
}
+ $maxnonegative += $record->weight;
// re-save with correct path to embeded media files
$record = file_postupdate_standard_editor($record, 'description', $this->descriptionopts, $PAGE->context,
'workshopform_numerrors', 'description', $record->id);
@@ -212,8 +214,8 @@ public function save_edit_strategy_form(stdclass $data) {
$insql = '';
}
$sql = "DELETE FROM {workshopform_numerrors_map}
- WHERE (($insql nonegative > :nodimensions) AND (workshopid = :workshopid))";
- $params['nodimensions'] = $norepeats;
+ WHERE (($insql nonegative > :maxnonegative) AND (workshopid = :workshopid))";
+ $params['maxnonegative'] = $maxnonegative;
$params['workshopid'] = $this->workshop->id;
$DB->execute($sql, $params);
}
Please sign in to comment.
Something went wrong with that request. Please try again.