@@ -55,40 +55,6 @@ class qtype_drawlines_question extends question_graded_automatically {
55
55
/** @var int The number of lines. */
56
56
public $ numberoflines ;
57
57
58
- /**
59
- * Work out a final grade for this attempt, taking into account
60
- * all the tries the student made and return the grade value.
61
- *
62
- * @param array $responses the response for each try. Each element of this
63
- * array is a response array, as would be passed to {@link grade_response()}.
64
- * There may be between 1 and $totaltries responses.
65
- *
66
- * @param int $totaltries The maximum number of tries allowed.
67
- *
68
- * @return float the fraction that should be awarded for this
69
- * sequence of response.
70
- */
71
- public function compute_final_grade (array $ responses , int $ totaltries ): float {
72
- // TODO: To incorporate the question penalty for interactive with multiple tries behaviour.
73
-
74
- $ grade = 0 ;
75
- foreach ($ responses as $ response ) {
76
- [$ fraction , $ state ] = $ this ->grade_response ($ response );
77
- $ grade += $ fraction ;
78
- }
79
- return $ grade ;
80
- }
81
-
82
- /**
83
- * Get a choice identifier
84
- *
85
- * @param int $choice stem number
86
- * @return string the question-type variable name.
87
- */
88
- public function choice ($ choice ) {
89
- return 'c ' . $ choice ;
90
- }
91
-
92
58
#[\Override]
93
59
public function get_expected_data () {
94
60
$ expecteddata = [];
@@ -249,62 +215,6 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $
249
215
}
250
216
}
251
217
252
- /**
253
- * Tests to see whether two arrays have the same set of coords at a particular key.
254
- * Coords can be in any order.
255
- *
256
- * @param array $array1 the first array.
257
- * @param array $array2 the second array.
258
- * @param string $key an array key.
259
- * @return bool whether the two arrays have the same set of coords (or lack of them)
260
- * for a given key.
261
- */
262
- public function arrays_same_at_key_integer (array $ array1 , array $ array2 , $ key ) {
263
- if (array_key_exists ($ key , $ array1 )) {
264
- $ value1 = $ array1 [$ key ];
265
- } else {
266
- $ value1 = '' ;
267
- }
268
- if (array_key_exists ($ key , $ array2 )) {
269
- $ value2 = $ array2 [$ key ];
270
- } else {
271
- $ value2 = '' ;
272
- }
273
- $ coords1 = explode ('; ' , $ value1 );
274
- $ coords2 = explode ('; ' , $ value2 );
275
- if (count ($ coords1 ) !== count ($ coords2 )) {
276
- return false ;
277
- } else {
278
- if (count ($ coords1 ) === 0 ) {
279
- return true ;
280
- } else {
281
- $ valuesinbotharrays = $ this ->array_intersect_fixed ($ coords1 , $ coords2 );
282
- return (count ($ valuesinbotharrays ) == count ($ coords1 ));
283
- }
284
- }
285
- }
286
-
287
- /**
288
- *
289
- * This function is a variation of array_intersect that checks for the existence of duplicate
290
- * array values too.
291
- *
292
- * @param array $array1
293
- * @param array $array2
294
- * @return bool whether array1 and array2 contain the same values including duplicate values
295
- * @author dml at nm dot ru (taken from comments on php manual)
296
- */
297
- protected function array_intersect_fixed ($ array1 , $ array2 ) {
298
- $ result = [];
299
- foreach ($ array1 as $ val ) {
300
- if (($ key = array_search ($ val , $ array2 , true )) !== false ) {
301
- $ result [] = $ val ;
302
- unset($ array2 [$ key ]);
303
- }
304
- }
305
- return $ result ;
306
- }
307
-
308
218
#[\Override]
309
219
public function get_validation_error (array $ response ): string {
310
220
if ($ this ->is_complete_response ($ response )) {
0 commit comments