Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
25fb2103
Commit
25fb2103
authored
Feb 27, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move return link to problem header
parent
afa7fca1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
23 deletions
+32
-23
common/lib/capa/capa/responsetypes.py
+15
-16
common/lib/capa/capa/templates/annotationinput.html
+8
-5
common/lib/xmodule/xmodule/css/capa/display.scss
+9
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
25fb2103
...
...
@@ -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
)
option
s
=
value
[
'options_value'
]
if
len
(
options
)
==
1
:
return
options
[
0
]
submitted
=
self
.
_unpack
(
student_answer
)
option
_ids
=
submitted
[
'options_value'
]
if
len
(
option
_id
s
)
==
1
:
return
option
_id
s
[
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
)
...
...
common/lib/capa/capa/templates/annotationinput.html
View file @
25fb2103
<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>
...
...
common/lib/xmodule/xmodule/css/capa/display.scss
View file @
25fb2103
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment