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
82cf37b2
Commit
82cf37b2
authored
Nov 29, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1085 from MITx/feature/victor/fix-self-assessment
Feature/victor/fix self assessment
parents
68158b39
4b58cb95
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
212 additions
and
60 deletions
+212
-60
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
+1
-1
common/lib/xmodule/xmodule/self_assessment_module.py
+138
-53
common/lib/xmodule/xmodule/tests/__init__.py
+3
-2
common/lib/xmodule/xmodule/tests/test_progress.py
+2
-2
common/lib/xmodule/xmodule/tests/test_self_assessment.py
+54
-0
common/lib/xmodule/xmodule/x_module.py
+14
-2
No files found.
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
View file @
82cf37b2
...
@@ -120,7 +120,7 @@ class @SelfAssessment
...
@@ -120,7 +120,7 @@ class @SelfAssessment
if
@
state
==
'done'
if
@
state
==
'done'
$
.
postWithPrefix
"
#{
@
ajax_url
}
/reset"
,
{},
(
response
)
=>
$
.
postWithPrefix
"
#{
@
ajax_url
}
/reset"
,
{},
(
response
)
=>
if
response
.
success
if
response
.
success
@
answer_area
.
htm
l
(
''
)
@
answer_area
.
va
l
(
''
)
@
rubric_wrapper
.
html
(
''
)
@
rubric_wrapper
.
html
(
''
)
@
hint_wrapper
.
html
(
''
)
@
hint_wrapper
.
html
(
''
)
@
message_wrapper
.
html
(
''
)
@
message_wrapper
.
html
(
''
)
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
82cf37b2
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/tests/__init__.py
View file @
82cf37b2
...
@@ -19,11 +19,12 @@ import xmodule
...
@@ -19,11 +19,12 @@ import xmodule
from
xmodule.x_module
import
ModuleSystem
from
xmodule.x_module
import
ModuleSystem
from
mock
import
Mock
from
mock
import
Mock
i4xs
=
ModuleSystem
(
test_system
=
ModuleSystem
(
ajax_url
=
'courses/course_id/modx/a_location'
,
ajax_url
=
'courses/course_id/modx/a_location'
,
track_function
=
Mock
(),
track_function
=
Mock
(),
get_module
=
Mock
(),
get_module
=
Mock
(),
render_template
=
Mock
(),
# "render" to just the context...
render_template
=
lambda
template
,
context
:
str
(
context
),
replace_urls
=
Mock
(),
replace_urls
=
Mock
(),
user
=
Mock
(),
user
=
Mock
(),
filestore
=
Mock
(),
filestore
=
Mock
(),
...
...
common/lib/xmodule/xmodule/tests/test_progress.py
View file @
82cf37b2
...
@@ -5,7 +5,7 @@ import unittest
...
@@ -5,7 +5,7 @@ import unittest
from
xmodule.progress
import
Progress
from
xmodule.progress
import
Progress
from
xmodule
import
x_module
from
xmodule
import
x_module
from
.
import
i4xs
from
.
import
test_system
class
ProgressTest
(
unittest
.
TestCase
):
class
ProgressTest
(
unittest
.
TestCase
):
''' Test that basic Progress objects work. A Progress represents a
''' Test that basic Progress objects work. A Progress represents a
...
@@ -133,6 +133,6 @@ class ModuleProgressTest(unittest.TestCase):
...
@@ -133,6 +133,6 @@ class ModuleProgressTest(unittest.TestCase):
'''
'''
def
test_xmodule_default
(
self
):
def
test_xmodule_default
(
self
):
'''Make sure default get_progress exists, returns None'''
'''Make sure default get_progress exists, returns None'''
xm
=
x_module
.
XModule
(
i4xs
,
'a://b/c/d/e'
,
None
,
{})
xm
=
x_module
.
XModule
(
test_system
,
'a://b/c/d/e'
,
None
,
{})
p
=
xm
.
get_progress
()
p
=
xm
.
get_progress
()
self
.
assertEqual
(
p
,
None
)
self
.
assertEqual
(
p
,
None
)
common/lib/xmodule/xmodule/tests/test_self_assessment.py
0 → 100644
View file @
82cf37b2
import
json
from
mock
import
Mock
import
unittest
from
xmodule.self_assessment_module
import
SelfAssessmentModule
from
xmodule.modulestore
import
Location
from
.
import
test_system
class
SelfAssessmentTest
(
unittest
.
TestCase
):
definition
=
{
'rubric'
:
'A rubric'
,
'prompt'
:
'Who?'
,
'submitmessage'
:
'Shall we submit now?'
,
'hintprompt'
:
'Consider this...'
,
}
location
=
Location
([
"i4x"
,
"edX"
,
"sa_test"
,
"selfassessment"
,
"SampleQuestion"
])
metadata
=
{
'attempts'
:
'10'
}
descriptor
=
Mock
()
def
test_import
(
self
):
state
=
json
.
dumps
({
'student_answers'
:
[
"Answer 1"
,
"answer 2"
,
"answer 3"
],
'scores'
:
[
0
,
1
],
'hints'
:
[
'o hai'
],
'state'
:
SelfAssessmentModule
.
ASSESSING
,
'attempts'
:
2
})
module
=
SelfAssessmentModule
(
test_system
,
self
.
location
,
self
.
definition
,
self
.
descriptor
,
state
,
{},
metadata
=
self
.
metadata
)
self
.
assertEqual
(
module
.
get_score
()[
'score'
],
0
)
self
.
assertTrue
(
'answer 3'
in
module
.
get_html
())
self
.
assertFalse
(
'answer 2'
in
module
.
get_html
())
module
.
save_assessment
({
'assessment'
:
'0'
})
self
.
assertEqual
(
module
.
state
,
module
.
REQUEST_HINT
)
module
.
save_hint
({
'hint'
:
'hint for ans 3'
})
self
.
assertEqual
(
module
.
state
,
module
.
DONE
)
d
=
module
.
reset
({})
self
.
assertTrue
(
d
[
'success'
])
self
.
assertEqual
(
module
.
state
,
module
.
INITIAL
)
# if we now assess as right, skip the REQUEST_HINT state
module
.
save_answer
({
'student_answer'
:
'answer 4'
})
module
.
save_assessment
({
'assessment'
:
'1'
})
self
.
assertEqual
(
module
.
state
,
module
.
DONE
)
common/lib/xmodule/xmodule/x_module.py
View file @
82cf37b2
...
@@ -288,8 +288,20 @@ class XModule(HTMLSnippet):
...
@@ -288,8 +288,20 @@ class XModule(HTMLSnippet):
return
'{}'
return
'{}'
def
get_score
(
self
):
def
get_score
(
self
):
''' Score the student received on the problem.
"""
'''
Score the student received on the problem, or None if there is no
score.
Returns:
dictionary
{'score': integer, from 0 to get_max_score(),
'total': get_max_score()}
NOTE (vshnayder): not sure if this was the intended return value, but
that's what it's doing now. I suspect that we really want it to just
return a number. Would need to change (at least) capa and
modx_dispatch to match if we did that.
"""
return
None
return
None
def
max_score
(
self
):
def
max_score
(
self
):
...
...
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