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
5e384334
Commit
5e384334
authored
Jan 07, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in static data for max score and max attempts
parent
c6c77c0c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
33 deletions
+18
-33
common/lib/xmodule/xmodule/combined_open_ended_module.py
+14
-6
common/lib/xmodule/xmodule/open_ended_module.py
+0
-14
common/lib/xmodule/xmodule/openendedchild.py
+3
-3
common/lib/xmodule/xmodule/self_assessment_module.py
+0
-9
lms/templates/combined_open_ended_status.html
+1
-1
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
5e384334
...
@@ -90,6 +90,11 @@ class CombinedOpenEndedModule(XModule):
...
@@ -90,6 +90,11 @@ class CombinedOpenEndedModule(XModule):
# completion (doesn't matter if you self-assessed correct/incorrect).
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
_max_score
=
int
(
self
.
metadata
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
static_data
=
{
'max_score'
:
self
.
_max_score
,
'max_attempts'
:
self
.
max_attempts
,
}
self
.
task_xml
=
definition
[
'task_xml'
]
self
.
task_xml
=
definition
[
'task_xml'
]
self
.
setup_next_task
()
self
.
setup_next_task
()
...
@@ -137,7 +142,7 @@ class CombinedOpenEndedModule(XModule):
...
@@ -137,7 +142,7 @@ class CombinedOpenEndedModule(XModule):
self
.
current_task_descriptor
=
children
[
'descriptors'
][
current_task_type
](
self
.
system
)
self
.
current_task_descriptor
=
children
[
'descriptors'
][
current_task_type
](
self
.
system
)
self
.
current_task_parsed_xml
=
self
.
current_task_descriptor
.
definition_from_xml
(
etree
.
fromstring
(
self
.
current_task_xml
),
self
.
system
)
self
.
current_task_parsed_xml
=
self
.
current_task_descriptor
.
definition_from_xml
(
etree
.
fromstring
(
self
.
current_task_xml
),
self
.
system
)
if
current_task_state
is
None
and
self
.
current_task_number
==
0
:
if
current_task_state
is
None
and
self
.
current_task_number
==
0
:
self
.
current_task
=
children
[
'modules'
][
current_task_type
](
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
)
self
.
current_task
=
children
[
'modules'
][
current_task_type
](
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
)
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
state
=
self
.
ASSESSING
self
.
state
=
self
.
ASSESSING
elif
current_task_state
is
None
and
self
.
current_task_number
>
0
:
elif
current_task_state
is
None
and
self
.
current_task_number
>
0
:
...
@@ -145,13 +150,13 @@ class CombinedOpenEndedModule(XModule):
...
@@ -145,13 +150,13 @@ class CombinedOpenEndedModule(XModule):
last_response
=
last_response_data
[
'response'
]
last_response
=
last_response_data
[
'response'
]
current_task_state
=
(
'{"state": "assessing", "version": 1, "max_score": '
+
str
(
self
.
_max_score
)
+
', '
+
current_task_state
=
(
'{"state": "assessing", "version": 1, "max_score": '
+
str
(
self
.
_max_score
)
+
', '
+
'"attempts": 0, "created": "True", "history": [{"answer": "'
+
str
(
last_response
)
+
'"}]}'
)
'"attempts": 0, "created": "True", "history": [{"answer": "'
+
str
(
last_response
)
+
'"}]}'
)
self
.
current_task
=
children
[
'modules'
][
current_task_type
](
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
instance_state
=
current_task_state
)
self
.
current_task
=
children
[
'modules'
][
current_task_type
](
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
,
instance_state
=
current_task_state
)
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
state
=
self
.
ASSESSING
self
.
state
=
self
.
ASSESSING
else
:
else
:
if
self
.
current_task_number
>
0
and
not
reset
:
if
self
.
current_task_number
>
0
and
not
reset
:
current_task_state
=
self
.
overwrite_state
(
current_task_state
)
current_task_state
=
self
.
overwrite_state
(
current_task_state
)
self
.
current_task
=
children
[
'modules'
][
current_task_type
](
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
instance_state
=
current_task_state
)
self
.
current_task
=
children
[
'modules'
][
current_task_type
](
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
,
instance_state
=
current_task_state
)
log
.
debug
(
self
.
current_task
.
get_instance_state
())
log
.
debug
(
self
.
current_task
.
get_instance_state
())
log
.
debug
(
self
.
get_instance_state
())
log
.
debug
(
self
.
get_instance_state
())
...
@@ -191,12 +196,15 @@ class CombinedOpenEndedModule(XModule):
...
@@ -191,12 +196,15 @@ class CombinedOpenEndedModule(XModule):
task_descriptor
=
children
[
'descriptors'
][
task_type
](
self
.
system
)
task_descriptor
=
children
[
'descriptors'
][
task_type
](
self
.
system
)
task_parsed_xml
=
task_descriptor
.
definition_from_xml
(
etree
.
fromstring
(
task_xml
),
self
.
system
)
task_parsed_xml
=
task_descriptor
.
definition_from_xml
(
etree
.
fromstring
(
task_xml
),
self
.
system
)
task
=
children
[
'modules'
][
task_type
](
self
.
system
,
self
.
location
,
task_parsed_xml
,
task_descriptor
,
instance_state
=
task_state
)
task
=
children
[
'modules'
][
task_type
](
self
.
system
,
self
.
location
,
task_parsed_xml
,
task_descriptor
,
self
.
static_data
,
instance_state
=
task_state
)
last_response
=
task
.
latest_answer
()
last_response
=
task
.
latest_answer
()
last_score
=
task
.
latest_score
()
last_score
=
task
.
latest_score
()
last_post_assessment
=
task
.
latest_post_assessment
()
last_post_assessment
=
task
.
latest_post_assessment
()
max_score
=
task
.
max_score
()
max_score
=
task
.
max_score
()
last_response_dict
=
{
'response'
:
last_response
,
'score'
:
last_score
,
'post_assessment'
:
last_post_assessment
,
'type'
:
task_type
,
'max_score'
:
max_score
}
state
=
task
.
state
last_response_dict
=
{
'response'
:
last_response
,
'score'
:
last_score
,
'post_assessment'
:
last_post_assessment
,
'type'
:
task_type
,
'max_score'
:
max_score
,
'state'
:
state
}
return
last_response_dict
return
last_response_dict
...
@@ -291,7 +299,7 @@ class CombinedOpenEndedModule(XModule):
...
@@ -291,7 +299,7 @@ class CombinedOpenEndedModule(XModule):
def
get_status
(
self
):
def
get_status
(
self
):
status
=
[]
status
=
[]
for
i
in
xrange
(
0
,
self
.
current_task_number
):
for
i
in
xrange
(
0
,
self
.
current_task_number
+
1
):
task_data
=
self
.
get_last_response
(
i
)
task_data
=
self
.
get_last_response
(
i
)
task_data
.
update
({
'task_number'
:
i
+
1
})
task_data
.
update
({
'task_number'
:
i
+
1
})
status
.
append
(
task_data
)
status
.
append
(
task_data
)
...
...
common/lib/xmodule/xmodule/open_ended_module.py
View file @
5e384334
...
@@ -34,15 +34,6 @@ from datetime import datetime
...
@@ -34,15 +34,6 @@ from datetime import datetime
log
=
logging
.
getLogger
(
"mitx.courseware"
)
log
=
logging
.
getLogger
(
"mitx.courseware"
)
# Set the default number of max attempts. Should be 1 for production
# Set higher for debugging/testing
# attempts specified in xml definition overrides this.
MAX_ATTEMPTS
=
1
# Set maximum available number of points.
# Overriden by max_score specified in xml.
MAX_SCORE
=
1
class
OpenEndedModule
(
openendedchild
.
OpenEndedChild
):
class
OpenEndedModule
(
openendedchild
.
OpenEndedChild
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
...
@@ -113,11 +104,6 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
...
@@ -113,11 +104,6 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
self
.
payload
=
{
'grader_payload'
:
updated_grader_payload
}
self
.
payload
=
{
'grader_payload'
:
updated_grader_payload
}
try
:
self
.
max_score
=
int
(
find_with_default
(
oeparam
,
'max_score'
,
1
))
except
ValueError
:
self
.
max_score
=
1
def
message_post
(
self
,
get
,
system
):
def
message_post
(
self
,
get
,
system
):
"""
"""
Handles a student message post (a reaction to the grade they received from an open ended grader type)
Handles a student message post (a reaction to the grade they received from an open ended grader type)
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
5e384334
...
@@ -69,7 +69,7 @@ class OpenEndedChild():
...
@@ -69,7 +69,7 @@ class OpenEndedChild():
POST_ASSESSMENT
=
'post_assessment'
POST_ASSESSMENT
=
'post_assessment'
DONE
=
'done'
DONE
=
'done'
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
static_data
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
"""
"""
Definition file should have 4 blocks -- prompt, rubric, submitmessage, hintprompt,
Definition file should have 4 blocks -- prompt, rubric, submitmessage, hintprompt,
...
@@ -118,11 +118,11 @@ class OpenEndedChild():
...
@@ -118,11 +118,11 @@ class OpenEndedChild():
self
.
created
=
instance_state
.
get
(
'created'
,
"False"
)
self
.
created
=
instance_state
.
get
(
'created'
,
"False"
)
self
.
attempts
=
instance_state
.
get
(
'attempts'
,
0
)
self
.
attempts
=
instance_state
.
get
(
'attempts'
,
0
)
self
.
max_attempts
=
int
(
instance_state
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
self
.
max_attempts
=
static_data
[
'max_attempts'
]
# Used for progress / grading. Currently get credit just for
# Used for progress / grading. Currently get credit just for
# completion (doesn't matter if you self-assessed correct/incorrect).
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
int
(
instance_state
.
get
(
'max_score'
,
MAX_SCORE
))
self
.
_max_score
=
static_data
[
'max_score'
]
self
.
setup_response
(
system
,
location
,
definition
,
descriptor
)
self
.
setup_response
(
system
,
location
,
definition
,
descriptor
)
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
5e384334
...
@@ -30,15 +30,6 @@ import openendedchild
...
@@ -30,15 +30,6 @@ import openendedchild
log
=
logging
.
getLogger
(
"mitx.courseware"
)
log
=
logging
.
getLogger
(
"mitx.courseware"
)
# Set the default number of max attempts. Should be 1 for production
# Set higher for debugging/testing
# attempts specified in xml definition overrides this.
MAX_ATTEMPTS
=
1
# Set maximum available number of points.
# Overriden by max_score specified in xml.
MAX_SCORE
=
1
class
SelfAssessmentModule
(
openendedchild
.
OpenEndedChild
):
class
SelfAssessmentModule
(
openendedchild
.
OpenEndedChild
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
...
...
lms/templates/combined_open_ended_status.html
View file @
5e384334
<section
id=
"combined-open-ended-status"
class=
"combined-open-ended-status"
>
<section
id=
"combined-open-ended-status"
class=
"combined-open-ended-status"
>
%for status in status_list:
%for status in status_list:
<statusitem>
<statusitem>
Step ${status['task_number']} : ${status['score']} / ${status['max_score']}
Step ${status['task_number']}
(${status['state']})
: ${status['score']} / ${status['max_score']}
%if status['type']=="openended":
%if status['type']=="openended":
${status['post_assessment']}
${status['post_assessment']}
%endif
%endif
...
...
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