File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,7 +192,11 @@ func MuEdToEvaluateFeedback(result map[string]any) []map[string]any {
192192}
193193
194194// MuEdToPreviewFeedback wraps a legacy preview result as [{"preSubmissionFeedback": result}].
195+ // Unwraps the nested "preview" key produced by legacy preview functions before wrapping.
195196func MuEdToPreviewFeedback (result map [string ]any ) []map [string ]any {
197+ if inner , ok := result ["preview" ].(map [string ]any ); ok {
198+ result = inner
199+ }
196200 return []map [string ]any {
197201 {"preSubmissionFeedback" : result },
198202 }
Original file line number Diff line number Diff line change @@ -271,8 +271,9 @@ func TestMuEdToEvalFeedback(t *testing.T) {
271271}
272272
273273func TestMuEdToPreviewFeedback (t * testing.T ) {
274- result := map [string ]any {"preview" : map [string ]any {"latex" : "x^2" }}
274+ inner := map [string ]any {"latex" : "x^2" }
275+ result := map [string ]any {"preview" : inner }
275276 fb := runtime .MuEdToPreviewFeedback (result )
276277 require .Len (t , fb , 1 )
277- assert .Equal (t , result , fb [0 ]["preSubmissionFeedback" ])
278+ assert .Equal (t , inner , fb [0 ]["preSubmissionFeedback" ])
278279}
You can’t perform that action at this time.
0 commit comments