Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 3572ec5

Browse files
committed
questionsapi: apply rstrip() to all results from sandbox API
1 parent 136f705 commit 3572ec5

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

CodeChallenge/api/questions.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def answer_next_question():
111111
except TypeError:
112112
return jsonify(status="success", correct=False)
113113

114-
115114
ans = Answer.query.filter_by(user_id=user.id, question_id=q.id).first()
116115

117116
if ans is None:
@@ -227,10 +226,7 @@ def answer_eval():
227226
reason="response from sandbox API was not JSON"), 500
228227

229228
eval_error = eval_data["error"]
230-
eval_output = str(eval_data["output"])
231-
232-
if language in ("python", "node"):
233-
eval_output = eval_output.rstrip() # remove trailing \n from print()
229+
eval_output = str(eval_data["output"]).rstrip()
234230

235231
# any API error is an automatic failure
236232
if eval_error:

0 commit comments

Comments
 (0)