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
c70531ae
Commit
c70531ae
authored
Feb 05, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move closed check logic into the OpenEndedChild
parent
018412ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
17 deletions
+10
-17
common/lib/xmodule/xmodule/combined_open_ended_module.py
+5
-13
common/lib/xmodule/xmodule/openendedchild.py
+5
-4
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
c70531ae
...
...
@@ -210,20 +210,12 @@ class CombinedOpenEndedModule(XModule):
'rubric'
:
definition
[
'rubric'
],
'display_name'
:
self
.
display_name
,
'accept_file_upload'
:
self
.
accept_file_upload
,
'close_date'
:
self
.
close_date
}
self
.
task_xml
=
definition
[
'task_xml'
]
self
.
setup_next_task
()
def
closed
(
self
):
''' Is the student still allowed to submit answers? '''
if
self
.
attempts
>=
self
.
max_attempts
:
return
True
if
self
.
close_date
is
not
None
and
datetime
.
datetime
.
utcnow
()
>
self
.
close_date
:
return
True
return
False
def
get_tag_name
(
self
,
xml
):
"""
...
...
@@ -306,7 +298,7 @@ class CombinedOpenEndedModule(XModule):
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
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
,
self
)
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
)
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
state
=
self
.
ASSESSING
elif
current_task_state
is
None
and
self
.
current_task_number
>
0
:
...
...
@@ -322,7 +314,7 @@ class CombinedOpenEndedModule(XModule):
})
self
.
current_task
=
child_task_module
(
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
,
self
,
instance_state
=
current_task_state
)
instance_state
=
current_task_state
)
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
state
=
self
.
ASSESSING
else
:
...
...
@@ -330,7 +322,7 @@ class CombinedOpenEndedModule(XModule):
current_task_state
=
self
.
overwrite_state
(
current_task_state
)
self
.
current_task
=
child_task_module
(
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
self
.
static_data
,
self
,
instance_state
=
current_task_state
)
instance_state
=
current_task_state
)
return
True
...
...
@@ -442,7 +434,7 @@ class CombinedOpenEndedModule(XModule):
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
,
self
,
instance_state
=
task_state
)
self
.
static_data
,
instance_state
=
task_state
)
last_response
=
task
.
latest_answer
()
last_score
=
task
.
latest_score
()
last_post_assessment
=
task
.
latest_post_assessment
(
self
.
system
)
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
c70531ae
...
...
@@ -73,7 +73,7 @@ class OpenEndedChild(object):
'done'
:
'Problem complete'
,
}
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
static_data
,
parent
,
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
static_data
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
# Load instance state
if
instance_state
is
not
None
:
...
...
@@ -87,8 +87,6 @@ class OpenEndedChild(object):
# Scores are on scale from 0 to max_score
self
.
history
=
instance_state
.
get
(
'history'
,
[])
self
.
parent
=
parent
self
.
state
=
instance_state
.
get
(
'state'
,
self
.
INITIAL
)
self
.
created
=
instance_state
.
get
(
'created'
,
False
)
...
...
@@ -100,6 +98,7 @@ class OpenEndedChild(object):
self
.
rubric
=
static_data
[
'rubric'
]
self
.
display_name
=
static_data
[
'display_name'
]
self
.
accept_file_upload
=
static_data
[
'accept_file_upload'
]
self
.
close_date
=
static_data
[
'close_date'
]
# Used for progress / grading. Currently get credit just for
# completion (doesn't matter if you self-assessed correct/incorrect).
...
...
@@ -119,7 +118,9 @@ class OpenEndedChild(object):
pass
def
closed
(
self
):
return
self
.
parent
.
closed
()
if
self
.
close_date
is
not
None
and
datetime
.
utcnow
()
>
self
.
close_date
:
return
True
return
False
def
latest_answer
(
self
):
"""Empty string if not available"""
...
...
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