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
5bcfba9e
Commit
5bcfba9e
authored
Nov 02, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add in ability to store multiple answers
parent
a60b914b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
common/lib/xmodule/xmodule/self_assessment_module.py
+6
-6
No files found.
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
5bcfba9e
...
@@ -113,7 +113,7 @@ class SelfAssessmentModule(XModule):
...
@@ -113,7 +113,7 @@ class SelfAssessmentModule(XModule):
if
instance_state
is
not
None
and
'student_answers'
in
instance_state
:
if
instance_state
is
not
None
and
'student_answers'
in
instance_state
:
if
(
type
(
instance_state
[
'student_answers'
])
in
[
type
(
u''
),
type
(
''
)]):
if
(
type
(
instance_state
[
'student_answers'
])
in
[
type
(
u''
),
type
(
''
)]):
self
.
answer
=
self
.
answer
.
append
(
instance_state
[
'student_answers'
])
self
.
answer
.
append
(
instance_state
[
'student_answers'
])
elif
(
type
(
instance_state
[
'student_answers'
])
==
type
([])):
elif
(
type
(
instance_state
[
'student_answers'
])
==
type
([])):
self
.
answer
=
instance_state
[
'student_answers'
]
self
.
answer
=
instance_state
[
'student_answers'
]
...
@@ -165,11 +165,14 @@ class SelfAssessmentModule(XModule):
...
@@ -165,11 +165,14 @@ class SelfAssessmentModule(XModule):
rubric_header
=
(
'<br/><br/><b>Rubric</b>'
)
rubric_header
=
(
'<br/><br/><b>Rubric</b>'
)
#Combine problem, rubric, and the forms
#Combine problem, rubric, and the forms
if
type
(
self
.
answer
)
==
type
([])
and
self
.
answer
is
not
[]
:
if
type
(
self
.
answer
)
==
type
([]):
if
len
(
self
.
answer
)
>
0
:
answer_html
=
"<br/>Previous answer: {0}<br/>"
.
format
(
self
.
answer
[
len
(
self
.
answer
)
-
1
])
answer_html
=
"<br/>Previous answer: {0}<br/>"
.
format
(
self
.
answer
[
len
(
self
.
answer
)
-
1
])
self
.
problem
=
''
.
join
([
self
.
problem
,
answer_html
,
problem_form
])
self
.
problem
=
''
.
join
([
self
.
problem
,
answer_html
,
problem_form
])
else
:
else
:
self
.
problem
=
''
.
join
([
self
.
problem
,
problem_form
])
self
.
problem
=
''
.
join
([
self
.
problem
,
problem_form
])
else
:
self
.
problem
=
''
.
join
([
self
.
problem
,
problem_form
])
self
.
rubric
=
''
.
join
([
rubric_header
,
self
.
rubric
,
rubric_form
])
self
.
rubric
=
''
.
join
([
rubric_header
,
self
.
rubric
,
rubric_form
])
...
@@ -231,8 +234,7 @@ class SelfAssessmentModule(XModule):
...
@@ -231,8 +234,7 @@ class SelfAssessmentModule(XModule):
"""
"""
#Check to see if attempts are less than max
#Check to see if attempts are less than max
if
(
self
.
attempts
<
self
.
max_attempts
):
if
(
self
.
attempts
<
self
.
max_attempts
):
self
.
answer
=
self
.
answer
.
append
(
get
.
keys
()[
0
])
self
.
answer
.
append
(
get
.
keys
()[
0
])
log
.
debug
(
self
.
answer
)
return
{
'success'
:
True
,
'rubric'
:
self
.
rubric
}
return
{
'success'
:
True
,
'rubric'
:
self
.
rubric
}
else
:
else
:
return
{
'success'
:
False
,
'message'
:
'Too many attempts.'
}
return
{
'success'
:
False
,
'message'
:
'Too many attempts.'
}
...
@@ -247,8 +249,6 @@ class SelfAssessmentModule(XModule):
...
@@ -247,8 +249,6 @@ class SelfAssessmentModule(XModule):
#Extract correctness from ajax and assign points
#Extract correctness from ajax and assign points
self
.
hint
=
get
[
get
.
keys
()[
1
]]
self
.
hint
=
get
[
get
.
keys
()[
1
]]
self
.
correctness
=
get
[
get
.
keys
()[
0
]]
.
lower
()
self
.
correctness
=
get
[
get
.
keys
()[
0
]]
.
lower
()
log
.
debug
(
self
.
hint
)
log
.
debug
(
self
.
correctness
)
points
=
0
points
=
0
if
self
.
correctness
==
"correct"
:
if
self
.
correctness
==
"correct"
:
points
=
1
points
=
1
...
...
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