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
a9a73e9a
Commit
a9a73e9a
authored
Nov 01, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
capa module integration
parent
a28b4ce1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
+2
-0
common/lib/xmodule/xmodule/self_assessment_module.py
+12
-8
No files found.
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
View file @
a9a73e9a
...
...
@@ -8,6 +8,8 @@ $(document).on('click', 'section.sa-wrapper input#show', ( ->
$
(
'section.sa-wrapper textarea#answer'
).
remove
()
$
(
'section.sa-wrapper p#rubric'
).
append
(
answer
)
$
(
'section.sa-wrapper p#rubric'
).
append
(
response
.
rubric
)
else
$
(
'section.sa-wrapper p#rubric'
).
append
(
response
.
message
)
));
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#save'
,
(
->
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
a9a73e9a
...
...
@@ -21,6 +21,8 @@ from xmodule.contentstore.content import XASSET_SRCREF_PREFIX, StaticContent
log
=
logging
.
getLogger
(
"mitx.courseware"
)
max_attempts
=
100
def
only_one
(
lst
,
default
=
""
,
process
=
lambda
x
:
x
):
"""
If lst is empty, returns default
...
...
@@ -88,7 +90,7 @@ class SelfAssessmentModule(XModule):
if
self
.
max_attempts
is
not
None
:
self
.
max_attempts
=
int
(
self
.
max_attempts
)
else
:
self
.
max_attempts
=
1
self
.
max_attempts
=
max_attempts
self
.
correctness
=
"incorrect"
self
.
done
=
False
...
...
@@ -111,9 +113,8 @@ class SelfAssessmentModule(XModule):
self
.
correctness
=
instance_state
[
'correct_map'
][
'self_assess'
][
'correctness'
]
def
get_score
(
self
):
return
self
.
score
return
{
'score'
:
self
.
score
}
def
max_score
(
self
):
return
self
.
top_score
...
...
@@ -121,8 +122,8 @@ class SelfAssessmentModule(XModule):
def
get_progress
(
self
):
''' For now, just return score / max_score
'''
score
=
self
.
get_score
()
total
=
self
.
max_score
()
score
=
self
.
score
total
=
self
.
top_score
if
total
>
0
:
try
:
return
Progress
(
score
,
total
)
...
...
@@ -161,9 +162,12 @@ class SelfAssessmentModule(XModule):
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
show_rubric
(
self
,
get
):
self
.
answer
=
get
.
keys
()[
0
]
log
.
debug
(
self
.
answer
)
return
{
'success'
:
True
,
'rubric'
:
self
.
rubric
}
if
(
self
.
attempts
<
self
.
max_attempts
):
self
.
answer
=
get
.
keys
()[
0
]
log
.
debug
(
self
.
answer
)
return
{
'success'
:
True
,
'rubric'
:
self
.
rubric
}
else
:
return
{
'success'
:
False
,
'message'
:
'Too many attempts.'
}
def
save_problem
(
self
,
get
):
'''
...
...
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