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
fee0facd
Commit
fee0facd
authored
Nov 06, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in some docs for tests, factor out class name in js
parent
71547e29
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
29 deletions
+25
-29
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
+17
-15
common/lib/xmodule/xmodule/tests/test_export.py
+1
-0
common/lib/xmodule/xmodule/tests/test_import.py
+4
-1
common/test/data/self_assessment/policies/2012_Fall.json
+3
-13
No files found.
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
View file @
fee0facd
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#show'
,
(
->
post_url
=
$
(
'section.sa-wrapper input#ajax_url'
).
attr
(
'url'
)
wrapper_name
=
'section.sa-wrapper'
$
(
document
).
on
(
'click'
,
"
#{
wrapper_name
}
input#show"
,
(
->
post_url
=
$
(
"
#{
wrapper_name
}
input#ajax_url"
).
attr
(
'url'
)
final_url
=
"
#{
post_url
}
/sa_show"
answer
=
$
(
'section.sa-wrapper textarea#answer'
).
val
()
answer
=
$
(
"
#{
wrapper_name
}
textarea#answer"
).
val
()
$
.
post
final_url
,
{
'student_answer'
:
answer
},
(
response
)
->
if
response
.
success
$
(
'section.sa-wrapper input#show'
).
remove
()
$
(
'section.sa-wrapper textarea#answer'
).
remove
()
$
(
'section.sa-wrapper p#rubric'
).
append
(
"Your answer:
#{
answer
}
"
)
$
(
'section.sa-wrapper p#rubric'
).
append
(
response
.
rubric
)
$
(
"
#{
wrapper_name
}
input#show"
).
remove
()
$
(
"
#{
wrapper_name
}
textarea#answer"
).
remove
()
$
(
"
#{
wrapper_name
}
p#rubric"
).
append
(
"Your answer:
#{
answer
}
"
)
$
(
"
#{
wrapper_name
}
p#rubric"
).
append
(
response
.
rubric
)
else
$
(
'section.sa-wrapper input#show'
).
remove
()
$
(
'section.sa-wrapper p#rubric'
).
append
(
response
.
message
)
$
(
"
#{
wrapper_name
}
input#show"
).
remove
()
$
(
"
#{
wrapper_name
}
p#rubric"
).
append
(
response
.
message
)
));
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#save'
,
(
->
assessment
=
$
(
'section.sa-wrapper #assessment'
).
find
(
':selected'
).
text
()
post_url
=
$
(
'section.sa-wrapper input#ajax_url'
).
attr
(
'url'
)
$
(
document
).
on
(
'click'
,
"
#{
wrapper_name
}
input#save"
,
(
->
assessment
=
$
(
"
#{
wrapper_name
}
#assessment"
).
find
(
':selected'
).
text
()
post_url
=
$
(
"
#{
wrapper_name
}
input#ajax_url"
).
attr
(
'url'
)
final_url
=
"
#{
post_url
}
/sa_save"
hint
=
$
(
'section.sa-wrapper textarea#hint'
).
val
()
hint
=
$
(
"
#{
wrapper_name
}
textarea#hint"
).
val
()
$
.
post
final_url
,
{
'assessment'
:
assessment
,
'hint'
:
hint
},
(
response
)
->
if
response
.
success
$
(
'section.sa-wrapper p#save_message'
).
append
(
response
.
message
)
$
(
'section.sa-wrapper input#save'
).
remove
()
$
(
"
#{
wrapper_name
}
p#save_message"
).
append
(
response
.
message
)
$
(
"
#{
wrapper_name
}
input#save"
).
remove
()
));
common/lib/xmodule/xmodule/tests/test_export.py
View file @
fee0facd
...
...
@@ -115,4 +115,5 @@ class RoundTripTestCase(unittest.TestCase):
self
.
check_export_roundtrip
(
DATA_DIR
,
"full"
)
def
test_selfassessment_roundtrip
(
self
):
#Test selfassessment xmodule to see if it exports correctly
self
.
check_export_roundtrip
(
DATA_DIR
,
"self_assessment"
)
common/lib/xmodule/xmodule/tests/test_import.py
View file @
fee0facd
...
...
@@ -314,7 +314,8 @@ class ImportTestCase(unittest.TestCase):
def
test_selfassessment_import
(
self
):
'''
Check to see if definition_from_xml and definition_to_xml in self_assessment_module.py function.
Check to see if definition_from_xml in self_assessment_module.py
works properly. Pulls data from the self_assessment directory in the test data directory.
'''
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
'self_assessment'
])
...
...
@@ -322,4 +323,5 @@ class ImportTestCase(unittest.TestCase):
sa_id
=
"edX/sa_test/2012_Fall"
location
=
Location
([
"i4x"
,
"edX"
,
"sa_test"
,
"selfassessment"
,
"SampleQuestion"
])
sa_sample
=
modulestore
.
get_instance
(
sa_id
,
location
)
#10 attempts is hard coded into SampleQuestion, which is the url_name of a selfassessment xml tag
self
.
assertEqual
(
sa_sample
.
metadata
[
'attempts'
],
'10'
)
\ No newline at end of file
common/test/data/self_assessment/policies/2012_Fall.json
View file @
fee0facd
...
...
@@ -2,23 +2,13 @@
"course/2012_Fall"
:
{
"graceperiod"
:
"2 days 5 hours 59 minutes 59 seconds"
,
"start"
:
"2015-07-17T12:00"
,
"display_name"
:
"
Toy Course
"
,
"display_name"
:
"
Self Assessment Test
"
,
"graded"
:
"true"
},
"chapter/Overview"
:
{
"display_name"
:
"Overview"
},
"videosequence/Toy_Videos"
:
{
"display_name"
:
"Toy Videos"
,
"format"
:
"Lecture Sequence"
"selfassessment/SampleQuestion"
:
{
"display_name"
:
"Sample Question"
,
},
"html/secret:toylab"
:
{
"display_name"
:
"Toy lab"
},
"video/Video_Resources"
:
{
"display_name"
:
"Video Resources"
},
"video/Welcome"
:
{
"display_name"
:
"Welcome"
}
}
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