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
6a535262
Commit
6a535262
authored
Jan 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix display errors
parent
ef27788c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
31 deletions
+54
-31
common/lib/xmodule/xmodule/open_ended_module.py
+53
-30
lms/templates/open_ended.html
+1
-1
No files found.
common/lib/xmodule/xmodule/open_ended_module.py
View file @
6a535262
...
@@ -154,6 +154,7 @@ class OpenEndedModule():
...
@@ -154,6 +154,7 @@ class OpenEndedModule():
# Note that OpenEndedResponse is agnostic to the specific contents of grader_payload
# Note that OpenEndedResponse is agnostic to the specific contents of grader_payload
prompt_string
=
stringify_children
(
prompt
)
prompt_string
=
stringify_children
(
prompt
)
rubric_string
=
stringify_children
(
rubric
)
rubric_string
=
stringify_children
(
rubric
)
self
.
prompt
=
prompt_string
grader_payload
=
oeparam
.
find
(
'grader_payload'
)
grader_payload
=
oeparam
.
find
(
'grader_payload'
)
grader_payload
=
grader_payload
.
text
if
grader_payload
is
not
None
else
''
grader_payload
=
grader_payload
.
text
if
grader_payload
is
not
None
else
''
...
@@ -568,36 +569,6 @@ class OpenEndedModule():
...
@@ -568,36 +569,6 @@ class OpenEndedModule():
return
dict
()
# No AJAX return is needed
return
dict
()
# No AJAX return is needed
def
get_html
(
self
,
system
):
"""
Implement special logic: handle queueing state, and default input.
"""
# if no student input yet, then use the default input given by the problem
latest_answer
=
self
.
latest_answer
()
if
latest_answer
is
None
:
value
=
self
.
initial_display
# Check if problem has been queued
self
.
queue_len
=
0
# Flag indicating that the problem has been queued, 'msg' is length of queue
if
self
.
state
==
self
.
ASSESSING
:
#self.queue_len = self.msg
#self.msg = self.submitted_msg
pass
context
=
{
'rows'
:
30
,
'cols'
:
80
,
'hidden'
:
''
,
'id'
:
'open_ended'
,
'msg'
:
"This is a message"
,
'state'
:
self
.
state
,
'queue_len'
:
self
.
queue_len
,
'value'
:
value
,
}
html
=
system
.
render_template
(
"open_ended.html"
,
context
)
return
html
def
change_state
(
self
,
new_state
):
def
change_state
(
self
,
new_state
):
"""
"""
A centralized place for state changes--allows for hooks. If the
A centralized place for state changes--allows for hooks. If the
...
@@ -656,6 +627,58 @@ class OpenEndedModule():
...
@@ -656,6 +627,58 @@ class OpenEndedModule():
history element"""
history element"""
self
.
history
[
-
1
][
'hint'
]
=
hint
self
.
history
[
-
1
][
'hint'
]
=
hint
def
_allow_reset
(
self
):
"""Can the module be reset?"""
return
self
.
state
==
self
.
DONE
and
self
.
attempts
<
self
.
max_attempts
def
get_html
(
self
,
system
):
#set context variables and render template
if
self
.
state
!=
self
.
INITIAL
:
latest
=
self
.
latest_answer
()
previous_answer
=
latest
if
latest
is
not
None
else
''
else
:
previous_answer
=
''
context
=
{
'prompt'
:
self
.
prompt
,
'previous_answer'
:
previous_answer
,
'state'
:
self
.
state
,
'allow_reset'
:
self
.
_allow_reset
(),
'rows'
:
30
,
'cols'
:
80
,
'hidden'
:
''
,
'id'
:
'open_ended'
,
}
html
=
system
.
render_template
(
'open_ended.html'
,
context
)
return
html
def
max_score
(
self
):
"""
Return max_score
"""
return
self
.
_max_score
def
get_score
(
self
):
"""
Returns the last score in the list
"""
score
=
self
.
latest_score
()
return
{
'score'
:
score
if
score
is
not
None
else
0
,
'total'
:
self
.
_max_score
}
def
get_progress
(
self
):
'''
For now, just return last score / max_score
'''
if
self
.
_max_score
>
0
:
try
:
return
Progress
(
self
.
get_score
()[
'score'
],
self
.
_max_score
)
except
Exception
as
err
:
log
.
exception
(
"Got bad progress"
)
return
None
return
None
class
OpenEndedDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
OpenEndedDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
"""
"""
...
...
lms/templates/open_ended.html
View file @
6a535262
<section
id=
"openended_${id}"
class=
"open
ende
d"
data-state=
"${state}"
>
<section
id=
"openended_${id}"
class=
"open
-ended-chil
d"
data-state=
"${state}"
>
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"input_${id}"
class=
"short-form-response"
id=
"input_${id}"
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"input_${id}"
class=
"short-form-response"
id=
"input_${id}"
%
if
hidden:
%
if
hidden:
style=
"display:none;"
style=
"display:none;"
...
...
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