Skip to content

Commit c80bedc

Browse files
committed
Updated OTHER submission type handling to replace content with value, adjusted related tests and logic in _extract_muEd_submission.
1 parent 35d50a9 commit c80bedc

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

tests/mued_handling_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ def test_text_submission_extracts_text(self):
192192
self.assertEqual(self.captured["answer"], "hello")
193193
self.assertEqual(result[0]["awardedPoints"], True) # type: ignore
194194

195-
def test_other_submission_extracts_content(self):
195+
def test_other_submission_extracts_value(self):
196196
event = {
197197
"path": "/evaluate",
198198
"body": {
199-
"submission": {"type": "OTHER", "content": {"content": "some text"}},
200-
"task": {"title": "T", "referenceSolution": {"content": "some text"}},
199+
"submission": {"type": "OTHER", "content": {"value": "some text"}},
200+
"task": {"title": "T", "referenceSolution": {"value": "some text"}},
201201
},
202202
}
203203
result = handler(event)
@@ -399,11 +399,11 @@ def test_text_submission_extracts_text(self):
399399

400400
self.assertEqual(self.captured["response"], "hello")
401401

402-
def test_other_submission_extracts_content(self):
402+
def test_other_submission_extracts_value(self):
403403
event = {
404404
"path": "/evaluate",
405405
"body": {
406-
"submission": {"type": "OTHER", "content": {"content": "some text"}},
406+
"submission": {"type": "OTHER", "content": {"value": "some text"}},
407407
"preSubmissionFeedback": {"enabled": True},
408408
},
409409
}

tests/mued_requests_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_valid_minimal_request(self):
5151
validate.body(body, MuEdReqBodyValidators.EVALUATION)
5252

5353
def test_valid_other_submission_type(self):
54-
body = {"submission": {"type": "OTHER", "content": {"content": "some text"}}}
54+
body = {"submission": {"type": "OTHER", "content": {"value": "some text"}}}
5555
validate.body(body, MuEdReqBodyValidators.EVALUATION)
5656

5757
def test_valid_request_with_task(self):

tools/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _extract_muEd_submission(body: JsonType):
142142
"""Extract response, params, and content_key from a muEd request body."""
143143
submission = body["submission"]
144144
sub_type = submission.get("type", "OTHER")
145-
_type_key = {"MATH": "expression", "TEXT": "text", "CODE": "code", "MODEL": "model", "OTHER": "content"}
145+
_type_key = {"MATH": "expression", "TEXT": "text", "CODE": "code", "MODEL": "model"}
146146
content_key = _type_key.get(sub_type, "value")
147147
response = submission.get("content", {}).get(content_key)
148148
params = body.get("configuration", {}).get("params", {})

0 commit comments

Comments
 (0)