From 868d70dbf779168427ce68fdd4e8379ab2669342 Mon Sep 17 00:00:00 2001 From: Artur Gaspar Date: Mon, 14 Oct 2024 17:10:57 -0300 Subject: [PATCH] fix: --- ai_eval/shortanswer.py | 7 ++++--- ai_eval/static/js/src/shortanswer_edit.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ai_eval/shortanswer.py b/ai_eval/shortanswer.py index 6b0807d..1130f7b 100644 --- a/ai_eval/shortanswer.py +++ b/ai_eval/shortanswer.py @@ -171,9 +171,10 @@ def _make_field_info(self, field_name, field): @XBlock.json_handler def submit_studio_edits(self, data, suffix=''): - for key, value in list(data["values"]["attachments"].items()): - if value is None: - data["values"]["attachments"][key] = self.attachments[key] + if "attachments" in data["values"]: + for key, value in list(data["values"]["attachments"].items()): + if value is None: + data["values"]["attachments"][key] = self.attachments[key] return super().submit_studio_edits.__wrapped__(self, data, suffix) @XBlock.handler diff --git a/ai_eval/static/js/src/shortanswer_edit.js b/ai_eval/static/js/src/shortanswer_edit.js index cdf6a11..a0eb51b 100644 --- a/ai_eval/static/js/src/shortanswer_edit.js +++ b/ai_eval/static/js/src/shortanswer_edit.js @@ -12,7 +12,7 @@ function ShortAnswerAIEvalXBlock(runtime, element) { var $wrapper = $('
'); var $fileList = $('