Skip to content

Commit 80d8bd9

Browse files
Jason.Plattsmchurchward
authored andcommitted
Fix feedback section errors when scorecalculation is empty
1 parent d202a7b commit 80d8bd9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

classes/feedback/section.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static function new_section($surveyid, $sectionlabel = '') {
9797
$newsection->surveyid = $surveyid;
9898
$newsection->section = $maxsection + 1;
9999
$newsection->sectionlabel = $sectionlabel;
100-
$newsection->scorecalculation = '';
100+
$newsection->scorecalculation = $newsection->encode_scorecalculation([]);
101101
$newsecid = $DB->insert_record(self::TABLE, $newsection);
102102
$newsection->id = $newsecid;
103103
$newsection->scorecalculation = [];

classes/question/sectiontext.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ protected function question_survey_display($response, $descendantsdata, $blankqu
101101

102102
// In which section(s) is this question?
103103
foreach ($fbsections as $key => $fbsection) {
104-
$scorecalculation = unserialize($fbsection->scorecalculation);
105-
if (array_key_exists($this->id, $scorecalculation)) {
106-
array_push($filteredsections, $fbsection->section);
104+
if ($scorecalculation = unserialize($fbsection->scorecalculation)) {
105+
if (array_key_exists($this->id, $scorecalculation)) {
106+
array_push($filteredsections, $fbsection->section);
107+
}
107108
}
108109
}
109110

0 commit comments

Comments
 (0)