Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturGaspar committed Oct 14, 2024
1 parent cd408c0 commit 868d70d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ai_eval/shortanswer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ai_eval/static/js/src/shortanswer_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function ShortAnswerAIEvalXBlock(runtime, element) {
var $wrapper = $('<div id="attachments-wrapper" class="wrapper-list-settings"/>');

var $fileList = $('<ul class="list-settings list-set"/>');
var files = JSON.parse($input.val());
var files = JSON.parse($input.val() || "{}");
for (var filename of Object.keys(files)) {
var $fileItem = $('<li class="list-settings-item"/>');
var $fileLink;
Expand Down

0 comments on commit 868d70d

Please sign in to comment.