Rename: use 'status' in templates as well as in the code.
This commit is contained in:
@@ -21,10 +21,6 @@ Each input type takes the xml tree as 'element', the previous answer as 'value',
|
||||
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,
|
||||
# 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.
|
||||
@@ -177,7 +173,7 @@ class OptionInput(InputTypeBase):
|
||||
context = {
|
||||
'id': self.id,
|
||||
'value': self.value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'msg': self.msg,
|
||||
'options': self.osetdict,
|
||||
'inline': self.xml.get('inline',''),
|
||||
@@ -236,7 +232,7 @@ class ChoiceGroup(InputTypeBase):
|
||||
def _get_render_context(self):
|
||||
context = {'id': self.id,
|
||||
'value': self.value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'input_type': self.element_type,
|
||||
'choices': self.choices,
|
||||
'name_array_suffix': self.suffix}
|
||||
@@ -362,7 +358,7 @@ class TextLine(InputTypeBase):
|
||||
|
||||
context = {'id': self.id,
|
||||
'value': value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'size': self.size,
|
||||
'msg': self.msg,
|
||||
'hidden': self.hidden,
|
||||
@@ -403,7 +399,7 @@ class FileSubmission(InputTypeBase):
|
||||
def _get_render_context(self):
|
||||
|
||||
context = {'id': self.id,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'msg': self.msg,
|
||||
'value': self.value,
|
||||
'queue_len': self.queue_len,
|
||||
@@ -455,7 +451,7 @@ class CodeInput(InputTypeBase):
|
||||
|
||||
context = {'id': self.id,
|
||||
'value': self.value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'msg': self.msg,
|
||||
'mode': self.mode,
|
||||
'linenumbers': self.linenumbers,
|
||||
@@ -492,7 +488,7 @@ class Schematic(InputTypeBase):
|
||||
context = {'id': self.id,
|
||||
'value': self.value,
|
||||
'initial_value': self.initial_value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'width': self.width,
|
||||
'height': self.height,
|
||||
'parts': self.parts,
|
||||
@@ -542,7 +538,7 @@ class ImageInput(InputTypeBase):
|
||||
'src': self.src,
|
||||
'gx': self.gx,
|
||||
'gy': self.gy,
|
||||
'state': self.status, # to change (VS: to what??)
|
||||
'status': self.status, # to change (VS: to what??)
|
||||
'msg': self.msg, # to change
|
||||
}
|
||||
return context
|
||||
@@ -577,7 +573,7 @@ class Crystallography(InputTypeBase):
|
||||
def _get_render_context(self):
|
||||
context = {'id': self.id,
|
||||
'value': self.value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'size': self.size,
|
||||
'msg': self.msg,
|
||||
'hidden': self.hidden,
|
||||
@@ -614,7 +610,7 @@ class VseprInput(InputTypeBase):
|
||||
|
||||
context = {'id': self.id,
|
||||
'value': self.value,
|
||||
'state': self.status,
|
||||
'status': self.status,
|
||||
'msg': self.msg,
|
||||
'width': self.width,
|
||||
'height': self.height,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<form class="choicegroup capa_inputtype" id="inputtype_${id}">
|
||||
<div class="indicator_container">
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<span class="correct" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
</div>
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
>${value|h}</textarea>
|
||||
|
||||
<div class="grader-status">
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<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>
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}">Incorrect</span>
|
||||
% elif state == 'queued':
|
||||
% elif status == 'queued':
|
||||
<span class="processing" id="status_${id}">Queued</span>
|
||||
<span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span>
|
||||
% endif
|
||||
@@ -21,7 +21,7 @@
|
||||
<div style="display:none;" name="${hidden}" inputid="input_${id}" />
|
||||
% endif
|
||||
|
||||
<p class="debug">${state}</p>
|
||||
<p class="debug">${status}</p>
|
||||
</div>
|
||||
|
||||
<span id="answer_${id}"></span>
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<div class="script_placeholder" data-src="/static/js/crystallography.js"></div>
|
||||
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<div class="unanswered" id="status_${id}">
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<div class="correct" id="status_${id}">
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<div class="incorrect" id="status_${id}">
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<div class="incorrect" id="status_${id}">
|
||||
% endif
|
||||
% if hidden:
|
||||
@@ -29,13 +29,13 @@
|
||||
/>
|
||||
|
||||
<p class="status">
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
unanswered
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
correct
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
incorrect
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
incomplete
|
||||
% endif
|
||||
</p>
|
||||
@@ -45,7 +45,7 @@
|
||||
% if msg:
|
||||
<span class="message">${msg|n}</span>
|
||||
% endif
|
||||
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
</div>
|
||||
% endif
|
||||
</section>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<section id="filesubmission_${id}" class="filesubmission">
|
||||
<div class="grader-status file">
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<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>
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}">Incorrect</span>
|
||||
% elif state == 'queued':
|
||||
% elif status == 'queued':
|
||||
<span class="processing" id="status_${id}">Queued</span>
|
||||
<span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span>
|
||||
% 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}"/>
|
||||
</div>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
<img src="/static/green-pointer.png" id="cross_${id}" style="position: absolute;top: ${gy}px;left: ${gx}px;" />
|
||||
</div>
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<span class="correct" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
</span>
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
<textarea style="display:none" id="input_${id}_fromjs" name="input_${id}_fromjs"></textarea>
|
||||
% endif
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<span class="correct" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
% if msg:
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
<span id="answer_${id}"></span>
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<span class="correct" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
</form>
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
</script>
|
||||
|
||||
<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>
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<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>
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
|
||||
% endif
|
||||
</span>
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<div class="script_placeholder" data-src="${preprocessor['script_src']}"/>
|
||||
% endif
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<div class="unanswered ${doinline}" id="status_${id}">
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<div class="correct ${doinline}" id="status_${id}">
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<div class="incorrect ${doinline}" id="status_${id}">
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<div class="incorrect ${doinline}" id="status_${id}">
|
||||
% endif
|
||||
% if hidden:
|
||||
@@ -33,13 +33,13 @@
|
||||
/>
|
||||
|
||||
<p class="status">
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
unanswered
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
correct
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
incorrect
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
incomplete
|
||||
% endif
|
||||
</p>
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
% endif
|
||||
|
||||
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
</div>
|
||||
% endif
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
<div class="script_placeholder" data-src="/static/js/vsepr/vsepr.js"></div>
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
<div class="unanswered" id="status_${id}">
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
<div class="correct" id="status_${id}">
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
<div class="incorrect" id="status_${id}">
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
<div class="incorrect" id="status_${id}">
|
||||
% endif
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
/>
|
||||
|
||||
<p class="status">
|
||||
% if state == 'unsubmitted':
|
||||
% if status == 'unsubmitted':
|
||||
unanswered
|
||||
% elif state == 'correct':
|
||||
% elif status == 'correct':
|
||||
correct
|
||||
% elif state == 'incorrect':
|
||||
% elif status == 'incorrect':
|
||||
incorrect
|
||||
% elif state == 'incomplete':
|
||||
% elif status == 'incomplete':
|
||||
incomplete
|
||||
% endif
|
||||
</p>
|
||||
@@ -42,7 +42,7 @@
|
||||
% if msg:
|
||||
<span class="message">${msg|n}</span>
|
||||
% endif
|
||||
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
</div>
|
||||
% endif
|
||||
</section>
|
||||
|
||||
@@ -39,7 +39,7 @@ class OptionInputTest(unittest.TestCase):
|
||||
|
||||
expected = {'value': 'Down',
|
||||
'options': [('Up', 'Up'), ('Down', 'Down')],
|
||||
'state': 'answered',
|
||||
'status': 'answered',
|
||||
'msg': '',
|
||||
'inline': '',
|
||||
'id': 'sky_input'}
|
||||
@@ -72,7 +72,7 @@ class ChoiceGroupTest(unittest.TestCase):
|
||||
|
||||
expected = {'id': 'sky_input',
|
||||
'value': 'foil3',
|
||||
'state': 'answered',
|
||||
'status': 'answered',
|
||||
'input_type': expected_input_type,
|
||||
'choices': [('foil1', '<text>This is foil One.</text>'),
|
||||
('foil2', '<text>This is foil Two.</text>'),
|
||||
@@ -147,7 +147,7 @@ class TextLineTest(unittest.TestCase):
|
||||
|
||||
expected = {'id': 'prob_1_2',
|
||||
'value': 'BumbleBee',
|
||||
'state': 'unanswered',
|
||||
'status': 'unanswered',
|
||||
'size': size,
|
||||
'msg': '',
|
||||
'hidden': False,
|
||||
@@ -175,7 +175,7 @@ class TextLineTest(unittest.TestCase):
|
||||
|
||||
expected = {'id': 'prob_1_2',
|
||||
'value': 'BumbleBee',
|
||||
'state': 'unanswered',
|
||||
'status': 'unanswered',
|
||||
'size': size,
|
||||
'msg': '',
|
||||
'hidden': False,
|
||||
@@ -215,7 +215,7 @@ class FileSubmissionTest(unittest.TestCase):
|
||||
context = the_input._get_render_context()
|
||||
|
||||
expected = {'id': 'prob_1_2',
|
||||
'state': 'queued',
|
||||
'status': 'queued',
|
||||
'msg': 'Submitted to grader.',
|
||||
'value': 'BumbleBee.py',
|
||||
'queue_len': '3',
|
||||
@@ -260,7 +260,7 @@ class CodeInputTest(unittest.TestCase):
|
||||
|
||||
expected = {'id': 'prob_1_2',
|
||||
'value': 'print "good evening"',
|
||||
'state': 'queued',
|
||||
'status': 'queued',
|
||||
'msg': 'Submitted to grader.',
|
||||
'mode': mode,
|
||||
'linenumbers': linenumbers,
|
||||
@@ -311,7 +311,7 @@ class SchematicTest(unittest.TestCase):
|
||||
expected = {'id': 'prob_1_2',
|
||||
'value': value,
|
||||
'initial_value': initial_value,
|
||||
'state': 'unsubmitted',
|
||||
'status': 'unsubmitted',
|
||||
'width': width,
|
||||
'height': height,
|
||||
'parts': parts,
|
||||
@@ -349,13 +349,12 @@ class ImageInputTest(unittest.TestCase):
|
||||
|
||||
expected = {'id': 'prob_1_2',
|
||||
'value': value,
|
||||
'state': 'unsubmitted',
|
||||
'status': 'unsubmitted',
|
||||
'width': width,
|
||||
'height': height,
|
||||
'src': src,
|
||||
'gx': egx,
|
||||
'gy': egy,
|
||||
'state': 'unsubmitted',
|
||||
'msg': ''}
|
||||
|
||||
self.assertEqual(context, expected)
|
||||
@@ -404,7 +403,7 @@ class CrystallographyTest(unittest.TestCase):
|
||||
|
||||
expected = {'id': 'prob_1_2',
|
||||
'value': value,
|
||||
'state': 'unsubmitted',
|
||||
'status': 'unsubmitted',
|
||||
'size': size,
|
||||
'msg': '',
|
||||
'hidden': '',
|
||||
|
||||
Reference in New Issue
Block a user