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
bcbf65e2
Commit
bcbf65e2
authored
Jan 11, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code reformat, line length fix, change text names to variables
parent
8dbbb021
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
common/lib/xmodule/xmodule/combined_open_ended_module.py
+0
-0
common/lib/xmodule/xmodule/open_ended_module.py
+0
-0
common/lib/xmodule/xmodule/openendedchild.py
+11
-11
common/lib/xmodule/xmodule/self_assessment_module.py
+9
-9
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
bcbf65e2
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/open_ended_module.py
View file @
bcbf65e2
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/openendedchild.py
View file @
bcbf65e2
...
@@ -63,11 +63,11 @@ class OpenEndedChild():
...
@@ -63,11 +63,11 @@ class OpenEndedChild():
DONE
=
'done'
DONE
=
'done'
#This is used to tell students where they are at in the module
#This is used to tell students where they are at in the module
HUMAN_NAMES
=
{
HUMAN_NAMES
=
{
'initial'
:
'Started'
,
'initial'
:
'Started'
,
'assessing'
:
'Being scored'
,
'assessing'
:
'Being scored'
,
'post_assessment'
:
'Scoring finished'
,
'post_assessment'
:
'Scoring finished'
,
'done'
:
'Problem complete'
,
'done'
:
'Problem complete'
,
}
}
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
static_data
,
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
static_data
,
...
@@ -84,7 +84,7 @@ class OpenEndedChild():
...
@@ -84,7 +84,7 @@ class OpenEndedChild():
# Scores are on scale from 0 to max_score
# Scores are on scale from 0 to max_score
self
.
history
=
instance_state
.
get
(
'history'
,
[])
self
.
history
=
instance_state
.
get
(
'history'
,
[])
self
.
state
=
instance_state
.
get
(
'state'
,
'initial'
)
self
.
state
=
instance_state
.
get
(
'state'
,
self
.
INITIAL
)
self
.
created
=
instance_state
.
get
(
'created'
,
"False"
)
self
.
created
=
instance_state
.
get
(
'created'
,
"False"
)
...
@@ -171,8 +171,8 @@ class OpenEndedChild():
...
@@ -171,8 +171,8 @@ class OpenEndedChild():
'state'
:
self
.
state
,
'state'
:
self
.
state
,
'max_score'
:
self
.
_max_score
,
'max_score'
:
self
.
_max_score
,
'attempts'
:
self
.
attempts
,
'attempts'
:
self
.
attempts
,
'created'
:
"False"
,
'created'
:
"False"
,
}
}
return
json
.
dumps
(
state
)
return
json
.
dumps
(
state
)
def
_allow_reset
(
self
):
def
_allow_reset
(
self
):
...
@@ -244,8 +244,8 @@ class OpenEndedChild():
...
@@ -244,8 +244,8 @@ class OpenEndedChild():
@param score: Numeric score.
@param score: Numeric score.
@return: Boolean correct.
@return: Boolean correct.
"""
"""
correct
=
False
correct
=
False
if
(
isinstance
(
score
,(
int
,
long
,
float
,
complex
))):
if
(
isinstance
(
score
,
(
int
,
long
,
float
,
complex
))):
score_ratio
=
int
(
score
)
/
float
(
self
.
max_score
())
score_ratio
=
int
(
score
)
/
float
(
self
.
max_score
())
correct
=
(
score_ratio
>=
0.66
)
correct
=
(
score_ratio
>=
0.66
)
return
correct
return
correct
...
@@ -255,7 +255,7 @@ class OpenEndedChild():
...
@@ -255,7 +255,7 @@ class OpenEndedChild():
Checks to see if the last response in the module is correct.
Checks to see if the last response in the module is correct.
@return: 'correct' if correct, otherwise 'incorrect'
@return: 'correct' if correct, otherwise 'incorrect'
"""
"""
score
=
self
.
get_score
()[
'score'
]
score
=
self
.
get_score
()[
'score'
]
correctness
=
'correct'
if
self
.
is_submission_correct
(
score
)
else
'incorrect'
correctness
=
'correct'
if
self
.
is_submission_correct
(
score
)
else
'incorrect'
return
correctness
return
correctness
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
bcbf65e2
...
@@ -40,6 +40,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -40,6 +40,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
</submitmessage>
</submitmessage>
</selfassessment>
</selfassessment>
"""
"""
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
"""
"""
Sets up the module
Sets up the module
...
@@ -76,7 +77,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -76,7 +77,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
'initial_message'
:
self
.
get_message_html
(),
'initial_message'
:
self
.
get_message_html
(),
'state'
:
self
.
state
,
'state'
:
self
.
state
,
'allow_reset'
:
self
.
_allow_reset
(),
'allow_reset'
:
self
.
_allow_reset
(),
'child_type'
:
'selfassessment'
,
'child_type'
:
'selfassessment'
,
}
}
html
=
system
.
render_template
(
'self_assessment_prompt.html'
,
context
)
html
=
system
.
render_template
(
'self_assessment_prompt.html'
,
context
)
...
@@ -112,7 +113,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -112,7 +113,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
})
})
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
get_rubric_html
(
self
,
system
):
def
get_rubric_html
(
self
,
system
):
"""
"""
Return the appropriate version of the rubric, based on the state.
Return the appropriate version of the rubric, based on the state.
"""
"""
...
@@ -121,8 +122,8 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -121,8 +122,8 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
# we'll render it
# we'll render it
context
=
{
'rubric'
:
self
.
rubric
,
context
=
{
'rubric'
:
self
.
rubric
,
'max_score'
:
self
.
_max_score
,
'max_score'
:
self
.
_max_score
,
}
}
if
self
.
state
==
self
.
ASSESSING
:
if
self
.
state
==
self
.
ASSESSING
:
context
[
'read_only'
]
=
False
context
[
'read_only'
]
=
False
...
@@ -133,7 +134,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -133,7 +134,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
return
system
.
render_template
(
'self_assessment_rubric.html'
,
context
)
return
system
.
render_template
(
'self_assessment_rubric.html'
,
context
)
def
get_hint_html
(
self
,
system
):
def
get_hint_html
(
self
,
system
):
"""
"""
Return the appropriate version of the hint view, based on state.
Return the appropriate version of the hint view, based on state.
"""
"""
...
@@ -201,7 +202,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -201,7 +202,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
return
{
return
{
'success'
:
True
,
'success'
:
True
,
'rubric_html'
:
self
.
get_rubric_html
(
system
)
'rubric_html'
:
self
.
get_rubric_html
(
system
)
}
}
def
save_assessment
(
self
,
get
,
system
):
def
save_assessment
(
self
,
get
,
system
):
"""
"""
...
@@ -228,7 +229,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -228,7 +229,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
self
.
record_latest_score
(
score
)
self
.
record_latest_score
(
score
)
d
=
{
'success'
:
True
,}
d
=
{
'success'
:
True
,
}
if
score
==
self
.
max_score
():
if
score
==
self
.
max_score
():
self
.
change_state
(
self
.
DONE
)
self
.
change_state
(
self
.
DONE
)
...
@@ -264,7 +265,6 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
...
@@ -264,7 +265,6 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
'allow_reset'
:
self
.
_allow_reset
()}
'allow_reset'
:
self
.
_allow_reset
()}
class
SelfAssessmentDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
SelfAssessmentDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
"""
"""
Module for adding self assessment questions to courses
Module for adding self assessment questions to courses
...
@@ -302,7 +302,7 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
...
@@ -302,7 +302,7 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
return
{
'submitmessage'
:
parse
(
'submitmessage'
),
return
{
'submitmessage'
:
parse
(
'submitmessage'
),
'hintprompt'
:
parse
(
'hintprompt'
),
'hintprompt'
:
parse
(
'hintprompt'
),
}
}
def
definition_to_xml
(
self
,
resource_fs
):
def
definition_to_xml
(
self
,
resource_fs
):
'''Return an xml element representing this definition.'''
'''Return an xml element representing this definition.'''
...
...
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