Commit 516b720f by Victor Shnayder

Rename: use 'status' in templates as well as in the code.

parent ab03f3dd
...@@ -21,10 +21,6 @@ Each input type takes the xml tree as 'element', the previous answer as 'value', ...@@ -21,10 +21,6 @@ Each input type takes the xml tree as 'element', the previous answer as 'value',
graded status as'status' graded status as'status'
""" """
# TODO: rename "state" to "status" for all below. status is currently the answer for the
# problem ID for the input element, but it will turn into a dict containing both the
# answer and any associated message for the problem ID for the input element.
# TODO: there is a lot of repetitive "grab these elements from xml attributes, with these defaults, # TODO: there is a lot of repetitive "grab these elements from xml attributes, with these defaults,
# put them in the context" code. Refactor so class just specifies required and optional attrs (with # put them in the context" code. Refactor so class just specifies required and optional attrs (with
# defaults for latter), and InputTypeBase does the right thing. # defaults for latter), and InputTypeBase does the right thing.
...@@ -177,7 +173,7 @@ class OptionInput(InputTypeBase): ...@@ -177,7 +173,7 @@ class OptionInput(InputTypeBase):
context = { context = {
'id': self.id, 'id': self.id,
'value': self.value, 'value': self.value,
'state': self.status, 'status': self.status,
'msg': self.msg, 'msg': self.msg,
'options': self.osetdict, 'options': self.osetdict,
'inline': self.xml.get('inline',''), 'inline': self.xml.get('inline',''),
...@@ -236,7 +232,7 @@ class ChoiceGroup(InputTypeBase): ...@@ -236,7 +232,7 @@ class ChoiceGroup(InputTypeBase):
def _get_render_context(self): def _get_render_context(self):
context = {'id': self.id, context = {'id': self.id,
'value': self.value, 'value': self.value,
'state': self.status, 'status': self.status,
'input_type': self.element_type, 'input_type': self.element_type,
'choices': self.choices, 'choices': self.choices,
'name_array_suffix': self.suffix} 'name_array_suffix': self.suffix}
...@@ -362,7 +358,7 @@ class TextLine(InputTypeBase): ...@@ -362,7 +358,7 @@ class TextLine(InputTypeBase):
context = {'id': self.id, context = {'id': self.id,
'value': value, 'value': value,
'state': self.status, 'status': self.status,
'size': self.size, 'size': self.size,
'msg': self.msg, 'msg': self.msg,
'hidden': self.hidden, 'hidden': self.hidden,
...@@ -403,7 +399,7 @@ class FileSubmission(InputTypeBase): ...@@ -403,7 +399,7 @@ class FileSubmission(InputTypeBase):
def _get_render_context(self): def _get_render_context(self):
context = {'id': self.id, context = {'id': self.id,
'state': self.status, 'status': self.status,
'msg': self.msg, 'msg': self.msg,
'value': self.value, 'value': self.value,
'queue_len': self.queue_len, 'queue_len': self.queue_len,
...@@ -455,7 +451,7 @@ class CodeInput(InputTypeBase): ...@@ -455,7 +451,7 @@ class CodeInput(InputTypeBase):
context = {'id': self.id, context = {'id': self.id,
'value': self.value, 'value': self.value,
'state': self.status, 'status': self.status,
'msg': self.msg, 'msg': self.msg,
'mode': self.mode, 'mode': self.mode,
'linenumbers': self.linenumbers, 'linenumbers': self.linenumbers,
...@@ -492,7 +488,7 @@ class Schematic(InputTypeBase): ...@@ -492,7 +488,7 @@ class Schematic(InputTypeBase):
context = {'id': self.id, context = {'id': self.id,
'value': self.value, 'value': self.value,
'initial_value': self.initial_value, 'initial_value': self.initial_value,
'state': self.status, 'status': self.status,
'width': self.width, 'width': self.width,
'height': self.height, 'height': self.height,
'parts': self.parts, 'parts': self.parts,
...@@ -542,7 +538,7 @@ class ImageInput(InputTypeBase): ...@@ -542,7 +538,7 @@ class ImageInput(InputTypeBase):
'src': self.src, 'src': self.src,
'gx': self.gx, 'gx': self.gx,
'gy': self.gy, 'gy': self.gy,
'state': self.status, # to change (VS: to what??) 'status': self.status, # to change (VS: to what??)
'msg': self.msg, # to change 'msg': self.msg, # to change
} }
return context return context
...@@ -577,7 +573,7 @@ class Crystallography(InputTypeBase): ...@@ -577,7 +573,7 @@ class Crystallography(InputTypeBase):
def _get_render_context(self): def _get_render_context(self):
context = {'id': self.id, context = {'id': self.id,
'value': self.value, 'value': self.value,
'state': self.status, 'status': self.status,
'size': self.size, 'size': self.size,
'msg': self.msg, 'msg': self.msg,
'hidden': self.hidden, 'hidden': self.hidden,
...@@ -614,7 +610,7 @@ class VseprInput(InputTypeBase): ...@@ -614,7 +610,7 @@ class VseprInput(InputTypeBase):
context = {'id': self.id, context = {'id': self.id,
'value': self.value, 'value': self.value,
'state': self.status, 'status': self.status,
'msg': self.msg, 'msg': self.msg,
'width': self.width, 'width': self.width,
'height': self.height, 'height': self.height,
......
<form class="choicegroup capa_inputtype" id="inputtype_${id}"> <form class="choicegroup capa_inputtype" id="inputtype_${id}">
<div class="indicator_container"> <div class="indicator_container">
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}"></span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% elif state == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% endif % endif
</div> </div>
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
>${value|h}</textarea> >${value|h}</textarea>
<div class="grader-status"> <div class="grader-status">
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}">Unanswered</span> <span class="unanswered" style="display:inline-block;" id="status_${id}">Unanswered</span>
% elif state == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}">Correct</span> <span class="correct" id="status_${id}">Correct</span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}">Incorrect</span> <span class="incorrect" id="status_${id}">Incorrect</span>
% elif state == 'queued': % elif status == 'queued':
<span class="processing" id="status_${id}">Queued</span> <span class="processing" id="status_${id}">Queued</span>
<span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span> <span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span>
% endif % endif
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div style="display:none;" name="${hidden}" inputid="input_${id}" /> <div style="display:none;" name="${hidden}" inputid="input_${id}" />
% endif % endif
<p class="debug">${state}</p> <p class="debug">${status}</p>
</div> </div>
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
<div class="script_placeholder" data-src="/static/js/crystallography.js"></div> <div class="script_placeholder" data-src="/static/js/crystallography.js"></div>
% if state == 'unsubmitted': % if status == 'unsubmitted':
<div class="unanswered" id="status_${id}"> <div class="unanswered" id="status_${id}">
% elif state == 'correct': % elif status == 'correct':
<div class="correct" id="status_${id}"> <div class="correct" id="status_${id}">
% elif state == 'incorrect': % elif status == 'incorrect':
<div class="incorrect" id="status_${id}"> <div class="incorrect" id="status_${id}">
% elif state == 'incomplete': % elif status == 'incomplete':
<div class="incorrect" id="status_${id}"> <div class="incorrect" id="status_${id}">
% endif % endif
% if hidden: % if hidden:
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
/> />
<p class="status"> <p class="status">
% if state == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif state == 'correct': % elif status == 'correct':
correct correct
% elif state == 'incorrect': % elif status == 'incorrect':
incorrect incorrect
% elif state == 'incomplete': % elif status == 'incomplete':
incomplete incomplete
% endif % endif
</p> </p>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${msg|n}</span>
% endif % endif
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete']: % if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div> </div>
% endif % endif
</section> </section>
<section id="filesubmission_${id}" class="filesubmission"> <section id="filesubmission_${id}" class="filesubmission">
<div class="grader-status file"> <div class="grader-status file">
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}">Unanswered</span> <span class="unanswered" style="display:inline-block;" id="status_${id}">Unanswered</span>
% elif state == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}">Correct</span> <span class="correct" id="status_${id}">Correct</span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}">Incorrect</span> <span class="incorrect" id="status_${id}">Incorrect</span>
% elif state == 'queued': % elif status == 'queued':
<span class="processing" id="status_${id}">Queued</span> <span class="processing" id="status_${id}">Queued</span>
<span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span> <span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span>
% endif % endif
<p class="debug">${state}</p> <p class="debug">${status}</p>
<input type="file" name="input_${id}" id="input_${id}" value="${value}" multiple="multiple" data-required_files="${required_files}" data-allowed_files="${allowed_files}"/> <input type="file" name="input_${id}" id="input_${id}" value="${value}" multiple="multiple" data-required_files="${required_files}" data-allowed_files="${allowed_files}"/>
</div> </div>
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<img src="/static/green-pointer.png" id="cross_${id}" style="position: absolute;top: ${gy}px;left: ${gx}px;" /> <img src="/static/green-pointer.png" id="cross_${id}" style="position: absolute;top: ${gy}px;left: ${gx}px;" />
</div> </div>
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}"></span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% elif state == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% endif % endif
</span> </span>
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
<textarea style="display:none" id="input_${id}_fromjs" name="input_${id}_fromjs"></textarea> <textarea style="display:none" id="input_${id}_fromjs" name="input_${id}_fromjs"></textarea>
% endif % endif
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}"></span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% elif state == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% endif % endif
% if msg: % if msg:
......
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}"></span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% elif state == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% endif % endif
</form> </form>
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
</script> </script>
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
% if state == 'unsubmitted': % if status == 'unsubmitted':
<span class="ui-icon ui-icon-bullet" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-bullet" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'correct': % elif status == 'correct':
<span class="ui-icon ui-icon-check" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-check" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'incorrect': % elif status == 'incorrect':
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'incomplete': % elif status == 'incomplete':
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
% endif % endif
</span> </span>
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
<div class="script_placeholder" data-src="${preprocessor['script_src']}"/> <div class="script_placeholder" data-src="${preprocessor['script_src']}"/>
% endif % endif
% if state == 'unsubmitted': % if status == 'unsubmitted':
<div class="unanswered ${doinline}" id="status_${id}"> <div class="unanswered ${doinline}" id="status_${id}">
% elif state == 'correct': % elif status == 'correct':
<div class="correct ${doinline}" id="status_${id}"> <div class="correct ${doinline}" id="status_${id}">
% elif state == 'incorrect': % elif status == 'incorrect':
<div class="incorrect ${doinline}" id="status_${id}"> <div class="incorrect ${doinline}" id="status_${id}">
% elif state == 'incomplete': % elif status == 'incomplete':
<div class="incorrect ${doinline}" id="status_${id}"> <div class="incorrect ${doinline}" id="status_${id}">
% endif % endif
% if hidden: % if hidden:
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
/> />
<p class="status"> <p class="status">
% if state == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif state == 'correct': % elif status == 'correct':
correct correct
% elif state == 'incorrect': % elif status == 'incorrect':
incorrect incorrect
% elif state == 'incomplete': % elif status == 'incomplete':
incomplete incomplete
% endif % endif
</p> </p>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
% endif % endif
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete']: % if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div> </div>
% endif % endif
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
<div class="script_placeholder" data-src="/static/js/vsepr/vsepr.js"></div> <div class="script_placeholder" data-src="/static/js/vsepr/vsepr.js"></div>
% if state == 'unsubmitted': % if status == 'unsubmitted':
<div class="unanswered" id="status_${id}"> <div class="unanswered" id="status_${id}">
% elif state == 'correct': % elif status == 'correct':
<div class="correct" id="status_${id}"> <div class="correct" id="status_${id}">
% elif state == 'incorrect': % elif status == 'incorrect':
<div class="incorrect" id="status_${id}"> <div class="incorrect" id="status_${id}">
% elif state == 'incomplete': % elif status == 'incomplete':
<div class="incorrect" id="status_${id}"> <div class="incorrect" id="status_${id}">
% endif % endif
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
/> />
<p class="status"> <p class="status">
% if state == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif state == 'correct': % elif status == 'correct':
correct correct
% elif state == 'incorrect': % elif status == 'incorrect':
incorrect incorrect
% elif state == 'incomplete': % elif status == 'incomplete':
incomplete incomplete
% endif % endif
</p> </p>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
% if msg: % if msg:
<span class="message">${msg|n}</span> <span class="message">${msg|n}</span>
% endif % endif
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete']: % if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div> </div>
% endif % endif
</section> </section>
...@@ -39,7 +39,7 @@ class OptionInputTest(unittest.TestCase): ...@@ -39,7 +39,7 @@ class OptionInputTest(unittest.TestCase):
expected = {'value': 'Down', expected = {'value': 'Down',
'options': [('Up', 'Up'), ('Down', 'Down')], 'options': [('Up', 'Up'), ('Down', 'Down')],
'state': 'answered', 'status': 'answered',
'msg': '', 'msg': '',
'inline': '', 'inline': '',
'id': 'sky_input'} 'id': 'sky_input'}
...@@ -72,7 +72,7 @@ class ChoiceGroupTest(unittest.TestCase): ...@@ -72,7 +72,7 @@ class ChoiceGroupTest(unittest.TestCase):
expected = {'id': 'sky_input', expected = {'id': 'sky_input',
'value': 'foil3', 'value': 'foil3',
'state': 'answered', 'status': 'answered',
'input_type': expected_input_type, 'input_type': expected_input_type,
'choices': [('foil1', '<text>This is foil One.</text>'), 'choices': [('foil1', '<text>This is foil One.</text>'),
('foil2', '<text>This is foil Two.</text>'), ('foil2', '<text>This is foil Two.</text>'),
...@@ -147,7 +147,7 @@ class TextLineTest(unittest.TestCase): ...@@ -147,7 +147,7 @@ class TextLineTest(unittest.TestCase):
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'value': 'BumbleBee', 'value': 'BumbleBee',
'state': 'unanswered', 'status': 'unanswered',
'size': size, 'size': size,
'msg': '', 'msg': '',
'hidden': False, 'hidden': False,
...@@ -175,7 +175,7 @@ class TextLineTest(unittest.TestCase): ...@@ -175,7 +175,7 @@ class TextLineTest(unittest.TestCase):
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'value': 'BumbleBee', 'value': 'BumbleBee',
'state': 'unanswered', 'status': 'unanswered',
'size': size, 'size': size,
'msg': '', 'msg': '',
'hidden': False, 'hidden': False,
...@@ -215,7 +215,7 @@ class FileSubmissionTest(unittest.TestCase): ...@@ -215,7 +215,7 @@ class FileSubmissionTest(unittest.TestCase):
context = the_input._get_render_context() context = the_input._get_render_context()
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'state': 'queued', 'status': 'queued',
'msg': 'Submitted to grader.', 'msg': 'Submitted to grader.',
'value': 'BumbleBee.py', 'value': 'BumbleBee.py',
'queue_len': '3', 'queue_len': '3',
...@@ -260,7 +260,7 @@ class CodeInputTest(unittest.TestCase): ...@@ -260,7 +260,7 @@ class CodeInputTest(unittest.TestCase):
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'state': 'queued', 'status': 'queued',
'msg': 'Submitted to grader.', 'msg': 'Submitted to grader.',
'mode': mode, 'mode': mode,
'linenumbers': linenumbers, 'linenumbers': linenumbers,
...@@ -311,7 +311,7 @@ class SchematicTest(unittest.TestCase): ...@@ -311,7 +311,7 @@ class SchematicTest(unittest.TestCase):
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'value': value, 'value': value,
'initial_value': initial_value, 'initial_value': initial_value,
'state': 'unsubmitted', 'status': 'unsubmitted',
'width': width, 'width': width,
'height': height, 'height': height,
'parts': parts, 'parts': parts,
...@@ -349,13 +349,12 @@ class ImageInputTest(unittest.TestCase): ...@@ -349,13 +349,12 @@ class ImageInputTest(unittest.TestCase):
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'value': value, 'value': value,
'state': 'unsubmitted', 'status': 'unsubmitted',
'width': width, 'width': width,
'height': height, 'height': height,
'src': src, 'src': src,
'gx': egx, 'gx': egx,
'gy': egy, 'gy': egy,
'state': 'unsubmitted',
'msg': ''} 'msg': ''}
self.assertEqual(context, expected) self.assertEqual(context, expected)
...@@ -404,7 +403,7 @@ class CrystallographyTest(unittest.TestCase): ...@@ -404,7 +403,7 @@ class CrystallographyTest(unittest.TestCase):
expected = {'id': 'prob_1_2', expected = {'id': 'prob_1_2',
'value': value, 'value': value,
'state': 'unsubmitted', 'status': 'unsubmitted',
'size': size, 'size': size,
'msg': '', 'msg': '',
'hidden': '', 'hidden': '',
......
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