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
84eba0da
Commit
84eba0da
authored
Nov 05, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper instance state storage, remove correctmap vars
parent
ea54454c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
24 deletions
+20
-24
common/lib/xmodule/xmodule/self_assessment_module.py
+20
-24
No files found.
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
84eba0da
...
...
@@ -33,6 +33,10 @@ log = logging.getLogger("mitx.courseware")
# attempts specified in xml definition overrides this.
MAX_ATTEMPTS
=
1
#Set maximum available number of points. Should be set to 1 for now due to correctness handling,
# which only allows for correct/incorrect.
MAX_SCORE
=
1
class
SelfAssessmentModule
(
XModule
):
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/selfassessment/display.coffee'
)]
}
...
...
@@ -89,7 +93,7 @@ class SelfAssessmentModule(XModule):
# Used for progress / grading. Currently get credit just for completion (doesn't matter if you self-assessed
# correct/incorrect).
self
.
score
=
instance_state
.
get
(
'score'
,
0
)
self
.
top_score
=
instance_state
.
get
(
'top_score'
,
1
)
self
.
top_score
=
instance_state
.
get
(
'top_score'
,
MAX_SCORE
)
# TODO: do we need this? True once everything is done
self
.
done
=
instance_state
.
get
(
'done'
,
False
)
...
...
@@ -176,7 +180,7 @@ class SelfAssessmentModule(XModule):
# Dump to temp to keep answer in sync with correctness and hint
# TODO: expecting something like get['answer']
self
.
temp_answer
=
get
.
keys
()[
0
]
self
.
temp_answer
=
get
[
'student_answer'
]
log
.
debug
(
self
.
temp_answer
)
return
{
'success'
:
True
,
...
...
@@ -200,8 +204,8 @@ class SelfAssessmentModule(XModule):
log
.
debug
(
self
.
temp_answer
)
if
self
.
temp_answer
is
not
""
:
#Extract correctness and hint from ajax and assign points
self
.
hints
.
append
(
get
[
get
.
keys
()[
1
]
])
curr_correctness
=
get
[
get
.
keys
()[
0
]
]
.
lower
()
self
.
hints
.
append
(
get
[
'hint'
])
curr_correctness
=
get
[
'assessment'
]
.
lower
()
if
curr_correctness
==
"correct"
:
points
=
1
self
.
correctness
.
append
(
curr_correctness
)
...
...
@@ -213,21 +217,16 @@ class SelfAssessmentModule(XModule):
# TODO: simplify tracking info to just log the relevant stuff
event_info
=
dict
()
event_info
[
'state'
]
=
{
'seed'
:
1
,
event_info
[
'state'
]
=
{
'student_answers'
:
self
.
student_answers
,
'hint'
:
self
.
hints
,
'correct_map'
:
{
'self_assess'
:
{
'correctness'
:
self
.
correctness
,
'npoints'
:
points
,
'msg'
:
""
,
'hint'
:
""
,
'hintmode'
:
""
,
'queuestate'
:
""
,
}},
'done'
:
self
.
done
}
'correctness'
:
self
.
correctness
,
'score'
:
points
,
'done'
:
self
.
done
}
# TODO: figure out how to identify self assessment. May not want to confuse with problems.
event_info
[
'selfassessment_id'
]
=
self
.
location
.
url
()
event_info
[
'answers'
]
=
self
.
student_answers
self
.
system
.
track_function
(
'save_problem_succeed'
,
event_info
)
...
...
@@ -248,19 +247,16 @@ class SelfAssessmentModule(XModule):
if
self
.
correctness
[
len
(
self
.
correctness
)
-
1
]
==
"correct"
:
points
=
1
state
=
{
'seed'
:
1
,
state
=
{
'student_answers'
:
self
.
student_answers
,
'temp_answer'
:
self
.
temp_answer
,
'hint'
:
self
.
hints
,
'correct_map'
:
{
'self_assess'
:
{
'correctness'
:
self
.
correctness
,
'npoints'
:
points
,
'msg'
:
""
,
'hint'
:
""
,
'hintmode'
:
""
,
'queuestate'
:
""
,
}},
'done'
:
self
.
done
}
state
[
'attempts'
]
=
self
.
attempts
'correctness'
:
self
.
correctness
,
'score'
:
points
,
'top_score'
:
MAX_SCORE
,
'done'
:
self
.
done
,
'attempts'
:
self
.
attempts
}
return
json
.
dumps
(
state
)
...
...
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