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
9d3f8ed0
Commit
9d3f8ed0
authored
Jan 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support open ended in combined open ended module
parent
1b9deb88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/xmodule/xmodule/combined_open_ended_module.py
+26
-1
No files found.
common/lib/capa/capa/inputtypes.py
View file @
9d3f8ed0
...
...
@@ -742,7 +742,7 @@ class OpenEndedInput(InputTypeBase):
etc.
"""
template
=
template
=
"openendedinput.html"
tags
=
[
'openendedinput'
]
# pulled out for testing
...
...
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
9d3f8ed0
...
...
@@ -20,6 +20,7 @@ from .x_module import XModule
from
.xml_module
import
XmlDescriptor
from
xmodule.modulestore
import
Location
import
self_assessment_module
import
open_ended_module
log
=
logging
.
getLogger
(
"mitx.courseware"
)
...
...
@@ -120,6 +121,24 @@ class CombinedOpenEndedModule(XModule):
self
.
state
=
self
.
ASSESSING
else
:
self
.
current_task
=
self_assessment_module
.
SelfAssessmentModule
(
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
instance_state
=
current_task_state
)
elif
current_task_type
==
"openended"
:
self
.
current_task_descriptor
=
open_ended_module
.
OpenEndedDescriptor
(
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
:
self
.
current_task
=
open_ended_module
.
OpenEndedModule
(
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
)
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
:
last_response
,
last_score
=
self
.
get_last_response
(
self
.
current_task_number
-
1
)
current_task_state
=
(
'{"state": "assessing", "version": 1, "max_score": '
+
str
(
self
.
_max_score
)
+
', '
+
'"attempts": 0, "history": [{"answer": "'
+
str
(
last_response
)
+
'"}]}'
)
{
"state"
:
"done"
,
"version"
:
1
,
"max_score"
:
1
,
"attempts"
:
1
,
"history"
:
[{
"answer"
:
"gdgddg"
,
"score"
:
0
,
"hint"
:
"dfdfdf"
}]}
self
.
current_task
=
open_ended_module
.
OpenEndedModule
(
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
instance_state
=
current_task_state
)
self
.
task_states
.
append
(
self
.
current_task
.
get_instance_state
())
self
.
state
=
self
.
ASSESSING
else
:
self
.
current_task
=
open_ended_module
.
OpenEndedModule
(
self
.
system
,
self
.
location
,
self
.
current_task_parsed_xml
,
self
.
current_task_descriptor
,
instance_state
=
current_task_state
)
return
True
...
...
@@ -158,6 +177,12 @@ class CombinedOpenEndedModule(XModule):
task
=
self_assessment_module
.
SelfAssessmentModule
(
self
.
system
,
self
.
location
,
task_parsed_xml
,
task_descriptor
,
instance_state
=
task_state
)
last_response
=
task
.
latest_answer
()
last_score
=
task
.
latest_score
()
elif
task_type
==
"openended"
:
task_descriptor
=
open_ended_module
.
OpenEndedDescriptor
(
self
.
system
)
task_parsed_xml
=
task_descriptor
.
definition_from_xml
(
etree
.
fromstring
(
task_xml
),
self
.
system
)
task
=
open_ended_module
.
OpenEndedModule
(
self
.
system
,
self
.
location
,
task_parsed_xml
,
task_descriptor
,
instance_state
=
task_state
)
last_response
=
task
.
latest_answer
()
last_score
=
task
.
latest_score
()
return
last_response
,
last_score
...
...
@@ -291,7 +316,7 @@ class CombinedOpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
def
definition_to_xml
(
self
,
resource_fs
):
'''Return an xml element representing this definition.'''
elt
=
etree
.
Element
(
'
selfassessment
'
)
elt
=
etree
.
Element
(
'
combinedopenended
'
)
def
add_child
(
k
):
child_str
=
'<{tag}>{body}</{tag}>'
.
format
(
tag
=
k
,
body
=
self
.
definition
[
k
])
...
...
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