move return link to problem header
This commit is contained in:
@@ -1848,28 +1848,27 @@ class AnnotationResponse(LoncapaResponse):
|
||||
response_tag = 'annotationresponse'
|
||||
allowed_inputfields = ['annotationinput']
|
||||
max_inputfields = 1
|
||||
default_scoring = { 'incorrect': 0, 'partial': 1, 'correct': 2 }
|
||||
|
||||
default_scoring = {'incorrect': 0, 'partial': 1, 'correct': 2 }
|
||||
def setup_response(self):
|
||||
xml = self.xml
|
||||
self.points_map = self._get_points_map()
|
||||
self.scoring_map = self._get_scoring_map()
|
||||
self.answer_map = self._get_answer_map()
|
||||
|
||||
def _get_points_map(self):
|
||||
def _get_scoring_map(self):
|
||||
''' Returns a dict of option->scoring for each input. '''
|
||||
scoring = self.default_scoring
|
||||
choices = dict(zip(scoring.keys(), scoring.keys()))
|
||||
points_map = {}
|
||||
choices = dict([(choice,choice) for choice in scoring])
|
||||
scoring_map = {}
|
||||
|
||||
for inputfield in self.inputfields:
|
||||
option_map = dict([(option['id'], {
|
||||
option_scoring = dict([(option['id'], {
|
||||
'correctness': choices.get(option['choice']),
|
||||
'points': scoring.get(option['choice'])
|
||||
}) for option in self._find_options(inputfield) ])
|
||||
|
||||
points_map[inputfield.get('id')] = option_map
|
||||
scoring_map[inputfield.get('id')] = option_scoring
|
||||
|
||||
return points_map
|
||||
return scoring_map
|
||||
|
||||
def _get_answer_map(self):
|
||||
''' Returns a dict of answers for each input.'''
|
||||
@@ -1913,21 +1912,21 @@ class AnnotationResponse(LoncapaResponse):
|
||||
'comment_value': comment_value
|
||||
}
|
||||
|
||||
def _get_submitted_option(self, student_answer):
|
||||
def _get_submitted_option_id(self, student_answer):
|
||||
''' Return the single option that was selected, otherwise None.'''
|
||||
value = self._unpack(student_answer)
|
||||
options = value['options_value']
|
||||
if len(options) == 1:
|
||||
return options[0]
|
||||
submitted = self._unpack(student_answer)
|
||||
option_ids = submitted['options_value']
|
||||
if len(option_ids) == 1:
|
||||
return option_ids[0]
|
||||
return None
|
||||
|
||||
def get_score(self, student_answers):
|
||||
''' Returns a CorrectMap for the student answer, which may include
|
||||
partially correct answers.'''
|
||||
student_answer = student_answers[self.answer_id]
|
||||
student_option = self._get_submitted_option(student_answer)
|
||||
student_option = self._get_submitted_option_id(student_answer)
|
||||
|
||||
scoring = self.points_map[self.answer_id]
|
||||
scoring = self.scoring_map[self.answer_id]
|
||||
is_valid = student_option is not None and student_option in scoring.keys()
|
||||
|
||||
(correctness, points) = ('incorrect', None)
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<form class="annotation-input">
|
||||
<div class="script_placeholder" data-src="/static/js/capa/annotationinput.js"/>
|
||||
|
||||
<div class="annotation-header">${title}</div>
|
||||
<div class="annotation-header">
|
||||
${title}
|
||||
|
||||
% if return_to_annotation:
|
||||
<a class="annotation-return" href="javascript:void(0)">Return to Annotation</a><br/>
|
||||
% endif
|
||||
</div>
|
||||
<div class="annotation-body">
|
||||
|
||||
<div class="block block-highlight">${text}</div>
|
||||
@@ -32,7 +38,7 @@
|
||||
<input type="hidden" class="value" name="input_${id}" id="input_${id}" value="${value|h}" />
|
||||
% endif
|
||||
|
||||
<span id="answer_${id}"></span>
|
||||
<p id="answer_${id}" class="answer answer-annotation"></p>
|
||||
|
||||
% if status == 'unsubmitted':
|
||||
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
|
||||
@@ -46,9 +52,6 @@
|
||||
<span class="incorrect" id="status_${id}"></span>
|
||||
% endif
|
||||
|
||||
% if return_to_annotation:
|
||||
<a class="annotation-return" href="javascript:void(0)">Return to Annotation</a><br/>
|
||||
% endif
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -816,8 +816,12 @@ section.problem {
|
||||
padding: .5em 1em;
|
||||
}
|
||||
.annotation-body { padding: .5em 1em; }
|
||||
.annotation-return { float: right; }
|
||||
.annotation-return:after { content: " \2191" }
|
||||
a.annotation-return {
|
||||
float: right;
|
||||
font: inherit;
|
||||
font-weight: normal;
|
||||
}
|
||||
a.annotation-return:after { content: " \2191" }
|
||||
|
||||
.block, ul.tags {
|
||||
margin: .5em 0;
|
||||
@@ -851,6 +855,9 @@ section.problem {
|
||||
}
|
||||
}
|
||||
textarea.comment { width: 100%; }
|
||||
.answer-annotation { display: block; margin: 0; }
|
||||
|
||||
/* for debugging the input value field. enable the debug flag on the inputtype */
|
||||
.debug-value {
|
||||
color: #fff;
|
||||
padding: 1em;
|
||||
|
||||
Reference in New Issue
Block a user