@@ -57,8 +57,7 @@ class qtype_coderunner_combinator_grader_outcome extends qtype_coderunner_testin
57
57
58
58
// A list of the allowed attributes in the combinator template grader return value.
59
59
public $ allowedfields = ['fraction ' , 'prologuehtml ' , 'testresults ' , 'files ' , 'epiloguehtml ' ,
60
- 'feedbackhtml ' , 'columnformats ' , 'showdifferences ' ,
61
- 'showoutputonly ' , 'graderstate ' , 'instructorhtml ' ,
60
+ 'columnformats ' , 'showdifferences ' , 'showoutputonly ' , 'graderstate ' , 'instructorhtml ' ,
62
61
];
63
62
64
63
public function __construct ($ isprecheck ) {
@@ -174,22 +173,20 @@ private function insert_file_urls($html, $urls) {
174
173
*/
175
174
public function set_mark_and_feedback ($ markfraction , $ feedback ) {
176
175
$ this ->actualmark = $ markfraction ; // Combinators work in the range 0 - 1.
177
- $ columnformats = $ feedback ['columnformats ' ] ?? null ;
178
176
$ testresults = $ feedback ['testresults ' ] ?? null ;
179
177
$ files = $ feedback ['files ' ] ?? null ;
180
- $ urls = null ;
181
- if ($ this ->valid_table_formats ($ testresults , $ columnformats )) {
182
- if ($ files ) {
183
- $ urls = $ this ->save_files ($ files );
184
- }
185
- foreach ($ feedback as $ field => $ value ) {
186
- if ($ urls && in_array ($ field , ['prologuehtml ' , 'epiloguehtml ' , 'instructorhtml ' , 'feedbackhtml ' ])) {
187
- $ this ->$ field = $ this ->insert_file_urls ($ value , $ urls );
188
- } else {
189
- $ this ->$ field = $ value ;
190
- }
178
+ $ urls = $ files ? $ this ->save_files ($ files ) : null ;
179
+
180
+ foreach ($ feedback as $ field => $ value ) {
181
+ if ($ urls && in_array ($ field , ['prologuehtml ' , 'epiloguehtml ' , 'instructorhtml ' ])) {
182
+ $ this ->$ field = $ this ->insert_file_urls ($ value , $ urls );
183
+ } else if (! in_array ($ field , ['files ' , 'testresults ' ])) {
184
+ $ this ->$ field = $ value ;
191
185
}
192
- $ this ->format_results_table ($ testresults , $ columnformats , $ urls );
186
+ }
187
+
188
+ if ($ this ->valid_table_formats ($ testresults , $ this ->columnformats )) {
189
+ $ this ->format_results_table ($ testresults , $ this ->columnformats , $ urls );
193
190
}
194
191
}
195
192
@@ -212,7 +209,7 @@ public function iscombinatorgrader() {
212
209
// but just output to be displayed as supplied. There is no message
213
210
// regarding success or failure with such questions.
214
211
public function is_output_only () {
215
- return isset ( $ this ->outputonly ) && $ this -> outputonly ;
212
+ return $ this ->outputonly ?? false ;
216
213
}
217
214
218
215
0 commit comments