Commit 22ce306f by Victor Shnayder

whitespace and comments

parent 63c1a8ea
...@@ -1851,7 +1851,7 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -1851,7 +1851,7 @@ class OpenEndedResponse(LoncapaResponse):
oeparam = self.xml.find('openendedparam') oeparam = self.xml.find('openendedparam')
prompt = self.xml.find('prompt') prompt = self.xml.find('prompt')
rubric = self.xml.find('openendedrubric') rubric = self.xml.find('openendedrubric')
self._parse(oeparam,prompt,rubric) self._parse(oeparam, prompt, rubric)
def stringify_children(self, node, strip_tags=True): def stringify_children(self, node, strip_tags=True):
""" """
...@@ -1890,7 +1890,7 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -1890,7 +1890,7 @@ class OpenEndedResponse(LoncapaResponse):
#Update grader payload with student id. If grader payload not json, error. #Update grader payload with student id. If grader payload not json, error.
try: try:
grader_payload=json.loads(grader_payload) grader_payload = json.loads(grader_payload)
# NOTE: self.system.location is valid because the capa_module # NOTE: self.system.location is valid because the capa_module
# __init__ adds it (easiest way to get problem location into # __init__ adds it (easiest way to get problem location into
# response types) # response types)
...@@ -1900,7 +1900,7 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -1900,7 +1900,7 @@ class OpenEndedResponse(LoncapaResponse):
'prompt' : prompt_string, 'prompt' : prompt_string,
'rubric' : rubric_string, 'rubric' : rubric_string,
}) })
grader_payload=json.dumps(grader_payload) grader_payload = json.dumps(grader_payload)
except Exception as err: except Exception as err:
log.error("Grader payload is not a json object!") log.error("Grader payload is not a json object!")
...@@ -1924,9 +1924,9 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -1924,9 +1924,9 @@ class OpenEndedResponse(LoncapaResponse):
top_score = oeparam.find('max_score') top_score = oeparam.find('max_score')
if top_score is not None: if top_score is not None:
try: try:
self.max_score= int(top_score.text) self.max_score = int(top_score.text)
except: except:
self.top_score=1 self.max_score = 1
else: else:
self.max_score = 1 self.max_score = 1
...@@ -1992,7 +1992,8 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -1992,7 +1992,8 @@ class OpenEndedResponse(LoncapaResponse):
# 2) Frontend: correctness='incomplete' eventually trickles down # 2) Frontend: correctness='incomplete' eventually trickles down
# through inputtypes.textbox and .filesubmission to inform the # through inputtypes.textbox and .filesubmission to inform the
# browser to poll the LMS # browser to poll the LMS
cmap.set(self.answer_id, queuestate=queuestate, correctness='incomplete', msg=msg) cmap.set(self.answer_id, queuestate=queuestate,
correctness='incomplete', msg=msg)
return cmap return cmap
...@@ -2001,7 +2002,7 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -2001,7 +2002,7 @@ class OpenEndedResponse(LoncapaResponse):
(valid_score_msg, correct, points, msg) = self._parse_score_msg(score_msg) (valid_score_msg, correct, points, msg) = self._parse_score_msg(score_msg)
if not valid_score_msg: if not valid_score_msg:
oldcmap.set(self.answer_id, oldcmap.set(self.answer_id,
msg='Invalid grader reply. Please contact the course staff.') msg = 'Invalid grader reply. Please contact the course staff.')
return oldcmap return oldcmap
correctness = 'correct' if correct else 'incorrect' correctness = 'correct' if correct else 'incorrect'
...@@ -2132,11 +2133,11 @@ class OpenEndedResponse(LoncapaResponse): ...@@ -2132,11 +2133,11 @@ class OpenEndedResponse(LoncapaResponse):
feedback = self._format_feedback(score_result) feedback = self._format_feedback(score_result)
score_ratio=int(score_result['score'])/self.max_score
correct=False # HACK: for now, just assume it's correct if you got more than 2/3.
if score_ratio>=.66: # Also assumes that score_result['score'] is an integer.
correct=True score_ratio = int(score_result['score']) / self.max_score
correct = (score_ratio >= 0.66)
log.debug(feedback) log.debug(feedback)
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment