@@ -106,17 +106,19 @@ public function create_question(?string $currentstate, object $formdata): questi
106
106
*
107
107
* @param string $questionstate
108
108
* @param int $variant variant which should be started (`1` for questions with only one variant)
109
+ * @param array|null $attributes
109
110
* @return attempt_started the attempt's state and metadata. Note that the attempt state never changes after the
110
111
* attempt has been started.
111
112
* @throws GuzzleException
112
113
* @throws request_error
113
114
* @throws moodle_exception
114
115
*/
115
- public function start_attempt (string $ questionstate , int $ variant ): attempt_started {
116
+ public function start_attempt (string $ questionstate , int $ variant, ? array $ attributes ): attempt_started {
116
117
$ options ['multipart ' ] = $ this ->transform_to_multipart (
117
118
[
118
119
'variant ' => $ variant ,
119
120
'context ' => $ this ->get_context_id (),
121
+ 'lms_provided_attributes ' => $ attributes ,
120
122
],
121
123
$ questionstate ,
122
124
);
@@ -128,6 +130,7 @@ public function start_attempt(string $questionstate, int $variant): attempt_star
128
130
* View a previously created attempt.
129
131
*
130
132
* @param string $questionstate
133
+ * @param array|null $attributes
131
134
* @param string $attemptstate the attempt state previously returned from {@see start_attempt()}
132
135
* @param string|null $scoringstate the last scoring state if this attempt has already been scored
133
136
* @param object|null $response data currently entered by the student
@@ -136,14 +139,15 @@ public function start_attempt(string $questionstate, int $variant): attempt_star
136
139
* @throws request_error
137
140
* @throws moodle_exception
138
141
*/
139
- public function view_attempt (string $ questionstate , string $ attemptstate , ?string $ scoringstate = null ,
142
+ public function view_attempt (string $ questionstate , ? array $ attributes , string $ attemptstate , ?string $ scoringstate = null ,
140
143
?object $ response = null ): attempt {
141
144
$ options ['multipart ' ] = $ this ->transform_to_multipart (
142
145
[
143
146
'attempt_state ' => $ attemptstate ,
144
147
'scoring_state ' => $ scoringstate ,
145
148
'response ' => $ response ,
146
149
'context ' => $ this ->get_context_id (),
150
+ 'lms_provided_attributes ' => $ attributes ,
147
151
],
148
152
$ questionstate ,
149
153
);
0 commit comments