Skip to content

Commit b7c8b98

Browse files
author
Ben Lerner
committed
fix broken cleanup (.each returns the map it iterated over) and upload belonging to submission, not grade
1 parent 3c77f92 commit b7c8b98

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/controllers/api/grades_controller.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def cleanup(node, replace)
2727
replace.each do |s, r|
2828
node = node.gsub(s, r)
2929
end
30+
node
3031
when Array
3132
node.map { |item| cleanup(item, replace) }
3233
when Hash
@@ -38,9 +39,10 @@ def cleanup(node, replace)
3839

3940
def handle_response(response)
4041
config_details = "(grade #{@grade.id}, grader #{@grader.id})"
41-
response = cleanup(response, {
42-
"$EXTRACTED/submission" => Upload.upload_path_for(@grade.upload.extracted_path.to_s)
43-
})
42+
replacements = {
43+
"$EXTRACTED/submission" => Upload.upload_path_for(@grade.submission.upload.extracted_path.to_s)
44+
}
45+
response = cleanup(response, replacements)
4446

4547
File.open(@grade.orca_result_path, 'w') do |f|
4648
f.write(JSON.generate(response.except(:key)))

0 commit comments

Comments
 (0)