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
b7c6f7ca
Commit
b7c6f7ca
authored
Mar 05, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mostly working state
parent
0d777a7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
30 deletions
+15
-30
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
+5
-4
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
+10
-26
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
View file @
b7c6f7ca
...
...
@@ -195,6 +195,7 @@ class CombinedOpenEndedV1Module():
last_response
=
last_response_data
[
'response'
]
loaded_task_state
=
json
.
loads
(
current_task_state
)
log
.
debug
(
loaded_task_state
)
if
loaded_task_state
[
'child_state'
]
==
self
.
INITIAL
:
loaded_task_state
[
'child_state'
]
=
self
.
ASSESSING
loaded_task_state
[
'child_created'
]
=
True
...
...
@@ -253,7 +254,6 @@ class CombinedOpenEndedV1Module():
#This sends the etree_xml object through the descriptor module of the current task, and
#returns the xml parsed by the descriptor
log
.
debug
(
current_task_state
)
self
.
current_task_parsed_xml
=
self
.
current_task_descriptor
.
definition_from_xml
(
etree_xml
,
self
.
system
)
if
current_task_state
is
None
and
self
.
current_task_number
==
0
:
self
.
current_task
=
child_task_module
(
self
.
system
,
self
.
location
,
...
...
@@ -264,7 +264,7 @@ class CombinedOpenEndedV1Module():
last_response_data
=
self
.
get_last_response
(
self
.
current_task_number
-
1
)
last_response
=
last_response_data
[
'response'
]
current_task_state
=
json
.
dumps
({
'state'
:
self
.
ASSESSING
,
'
child_
state'
:
self
.
ASSESSING
,
'version'
:
self
.
STATE_VERSION
,
'max_score'
:
self
.
_max_score
,
'child_attempts'
:
0
,
...
...
@@ -276,6 +276,7 @@ class CombinedOpenEndedV1Module():
instance_state
=
current_task_state
)
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
state
=
self
.
ASSESSING
log
.
debug
(
self
.
task_states
)
else
:
if
self
.
current_task_number
>
0
and
not
reset
:
current_task_state
=
self
.
overwrite_state
(
current_task_state
)
...
...
@@ -394,7 +395,7 @@ class CombinedOpenEndedV1Module():
task_parsed_xml
=
task_descriptor
.
definition_from_xml
(
etree_xml
,
self
.
system
)
task
=
children
[
'modules'
][
task_type
](
self
.
system
,
self
.
location
,
task_parsed_xml
,
task_descriptor
,
self
.
static_data
,
instance_state
=
self
.
instance
_state
,
model_data
=
self
.
_model_data
)
self
.
static_data
,
instance_state
=
task
_state
,
model_data
=
self
.
_model_data
)
last_response
=
task
.
latest_answer
()
last_score
=
task
.
latest_score
()
last_post_assessment
=
task
.
latest_post_assessment
(
self
.
system
)
...
...
@@ -479,7 +480,7 @@ class CombinedOpenEndedV1Module():
if
not
self
.
allow_reset
:
self
.
task_states
[
self
.
current_task_number
]
=
self
.
current_task
.
get_instance_state
()
current_task_state
=
json
.
loads
(
self
.
task_states
[
self
.
current_task_number
])
if
current_task_state
[
'state'
]
==
self
.
DONE
:
if
current_task_state
[
'
child_
state'
]
==
self
.
DONE
:
self
.
current_task_number
+=
1
if
self
.
current_task_number
>=
(
len
(
self
.
task_xml
)):
self
.
state
=
self
.
DONE
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
View file @
b7c6f7ca
...
...
@@ -65,7 +65,7 @@ class OpenEndedChild(object):
}
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
static_data
,
instance_state
=
None
,
shared_state
=
None
,
model_data
=
None
,
task_number
=
None
,
**
kwargs
):
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
# Load instance state
if
instance_state
is
not
None
:
...
...
@@ -80,27 +80,11 @@ class OpenEndedChild(object):
# None for any element, and score and hint can be None for the last (current)
# element.
# Scores are on scale from 0 to max_score
self
.
_model_data
=
model_data
task_state
=
{}
try
:
self
.
child_history
=
instance_state
[
'task_states'
][
task_number
][
'history'
]
except
:
self
.
child_history
=
[]
try
:
self
.
child_state
=
instance_state
[
'task_states'
][
task_number
][
'state'
]
except
:
self
.
child_state
=
self
.
INITIAL
try
:
self
.
child_created
=
instance_state
[
'task_states'
][
task_number
][
'created'
]
except
:
self
.
child_created
=
False
try
:
self
.
child_attempts
=
instance_state
[
'task_states'
][
task_number
][
'attempts'
]
except
:
self
.
child_attempts
=
0
self
.
child_history
=
instance_state
.
get
(
'child_history'
,[])
self
.
child_state
=
instance_state
.
get
(
'child_state'
,
self
.
INITIAL
)
self
.
child_created
=
instance_state
.
get
(
'child_created'
,
False
)
self
.
child_attempts
=
instance_state
.
get
(
'child_attempts'
,
0
)
self
.
max_attempts
=
static_data
[
'max_attempts'
]
self
.
child_prompt
=
static_data
[
'prompt'
]
...
...
@@ -233,11 +217,11 @@ class OpenEndedChild(object):
state
=
{
'version'
:
self
.
STATE_VERSION
,
'history'
:
self
.
child_history
,
'state'
:
self
.
child_state
,
'
child_
history'
:
self
.
child_history
,
'
child_
state'
:
self
.
child_state
,
'max_score'
:
self
.
_max_score
,
'attempts'
:
self
.
child_attempts
,
'created'
:
False
,
'
child_
attempts'
:
self
.
child_attempts
,
'c
hild_c
reated'
:
False
,
}
return
json
.
dumps
(
state
)
...
...
@@ -275,7 +259,7 @@ class OpenEndedChild(object):
'''
if
self
.
_max_score
>
0
:
try
:
return
Progress
(
self
.
get_score
()[
'score'
],
self
.
_max_score
)
return
Progress
(
int
(
self
.
get_score
()[
'score'
]),
int
(
self
.
_max_score
)
)
except
Exception
as
err
:
#This is a dev_facing_error
log
.
exception
(
"Got bad progress from open ended child module. Max Score: {0}"
.
format
(
self
.
_max_score
))
...
...
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