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
37b85933
Commit
37b85933
authored
Nov 01, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added extensions to persist state
parent
ef7d7ca6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
+0
-2
common/lib/xmodule/xmodule/self_assessment_module.py
+19
-4
No files found.
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
View file @
37b85933
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#show'
,
(
->
root
=
location
.
protocol
+
"//"
+
location
.
host
post_url
=
$
(
'section.sa-wrapper input#show'
).
attr
(
'url'
)
final_url
=
"/courses/MITx/6.002x/2012_Fall/modx/
#{
post_url
}
/sa_show"
answer
=
$
(
'section.sa-wrapper textarea#answer'
).
val
()
...
...
@@ -13,7 +12,6 @@ $(document).on('click', 'section.sa-wrapper input#show', ( ->
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#save'
,
(
->
assessment_correct
=
$
(
'section.sa-wrapper #assessment'
).
find
(
':selected'
).
text
()
root
=
location
.
protocol
+
"//"
+
location
.
host
post_url
=
$
(
'section.sa-wrapper input#save'
).
attr
(
'url'
)
final_url
=
"/courses/MITx/6.002x/2012_Fall/modx/
#{
post_url
}
/sa_save"
$
.
post
final_url
,
assessment_correct
,
(
response
)
->
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
37b85933
...
...
@@ -82,22 +82,34 @@ class SelfAssessmentModule(XModule):
self
.
score
=
0
self
.
top_score
=
1
self
.
submit_message
=
etree
.
tostring
(
dom2
.
xpath
(
'submitmessage'
)[
0
])
log
.
debug
(
self
.
submit_message
)
self
.
attempts
=
0
self
.
max_attempts
=
1
self
.
max_attempts
=
self
.
metadata
.
get
(
'attempts'
,
None
)
if
self
.
max_attempts
is
not
None
:
self
.
max_attempts
=
int
(
self
.
max_attempts
)
else
:
self
.
max_attempts
=
1
self
.
correctness
=
"incorrect"
self
.
done
=
False
if
instance_state
is
not
None
:
instance_state
=
json
.
loads
(
instance_state
)
log
.
debug
(
instance_state
)
if
instance_state
is
not
None
and
'attempts'
in
instance_state
:
self
.
attempts
=
instance_state
[
'attempts'
]
self
.
correctness
=
"incorrect"
if
instance_state
is
not
None
and
'student_answers'
in
instance_state
:
self
.
answer
=
instance_state
[
'student_answers'
]
if
instance_state
is
not
None
and
'done'
in
instance_state
:
self
.
done
=
instance_state
[
'done'
]
if
instance_state
is
not
None
and
'correct_map'
in
instance_state
:
if
'self_assess'
in
instance_state
[
'correct_map'
]:
self
.
score
=
instance_state
[
'correct_map'
][
'self_assess'
][
'npoints'
]
self
.
correctness
=
instance_state
[
'correct_map'
][
'self_assess'
][
'correctness'
]
def
get_score
(
self
):
...
...
@@ -166,6 +178,7 @@ class SelfAssessmentModule(XModule):
if
self
.
correctness
==
"correct"
:
points
=
1
event_info
=
dict
()
self
.
done
=
True
event_info
[
'state'
]
=
{
'seed'
:
1
,
'student_answers'
:
self
.
answer
,
'correct_map'
:
{
'self_assess'
:
{
'correctness'
:
self
.
correctness
,
...
...
@@ -181,6 +194,8 @@ class SelfAssessmentModule(XModule):
event_info
[
'answers'
]
=
self
.
answer
self
.
attempts
=
self
.
attempts
+
1
self
.
system
.
track_function
(
'save_problem_succeed'
,
event_info
)
return
{
'success'
:
True
,
'message'
:
self
.
submit_message
}
...
...
@@ -189,7 +204,7 @@ class SelfAssessmentModule(XModule):
points
=
0
if
self
.
correctness
==
"correct"
:
points
=
1
state
=
return
{
'seed'
:
1
,
state
=
{
'seed'
:
1
,
'student_answers'
:
self
.
answer
,
'correct_map'
:
{
'self_assess'
:
{
'correctness'
:
self
.
correctness
,
'npoints'
:
points
,
...
...
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