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
ef27788c
Commit
ef27788c
authored
Jan 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial display for open ended problem
parent
a5eec6d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
14 deletions
+46
-14
common/lib/xmodule/xmodule/open_ended_module.py
+41
-9
lms/templates/open_ended.html
+5
-5
No files found.
common/lib/xmodule/xmodule/open_ended_module.py
View file @
ef27788c
...
...
@@ -573,25 +573,26 @@ class OpenEndedModule():
Implement special logic: handle queueing state, and default input.
"""
# if no student input yet, then use the default input given by the problem
if
not
self
.
value
:
self
.
value
=
self
.
xml
.
text
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
.
stat
us
==
'incomplete'
:
self
.
status
=
'queued'
self
.
queue_len
=
self
.
msg
self
.
msg
=
self
.
submitted_msg
if
self
.
stat
e
==
self
.
ASSESSING
:
#self.queue_len = self.msg
#self.msg = self.submitted_
msg
pass
context
=
{
'rows'
:
30
,
'cols'
:
80
,
'hidden'
:
''
,
'id'
:
'open_ended'
,
'msg'
:
self
.
msg
,
'stat
us'
:
self
.
status
,
'msg'
:
"This is a message"
,
'stat
e'
:
self
.
state
,
'queue_len'
:
self
.
queue_len
,
'value'
:
self
.
value
,
'value'
:
value
,
}
html
=
system
.
render_template
(
"open_ended.html"
,
context
)
...
...
@@ -624,6 +625,37 @@ class OpenEndedModule():
}
return
json
.
dumps
(
state
)
def
latest_answer
(
self
):
"""None if not available"""
if
not
self
.
history
:
return
None
return
self
.
history
[
-
1
]
.
get
(
'answer'
)
def
latest_score
(
self
):
"""None if not available"""
if
not
self
.
history
:
return
None
return
self
.
history
[
-
1
]
.
get
(
'score'
)
def
latest_hint
(
self
):
"""None if not available"""
if
not
self
.
history
:
return
None
return
self
.
history
[
-
1
]
.
get
(
'hint'
)
def
new_history_entry
(
self
,
answer
):
self
.
history
.
append
({
'answer'
:
answer
})
def
record_latest_score
(
self
,
score
):
"""Assumes that state is right, so we're adding a score to the latest
history element"""
self
.
history
[
-
1
][
'score'
]
=
score
def
record_latest_hint
(
self
,
hint
):
"""Assumes that state is right, so we're adding a score to the latest
history element"""
self
.
history
[
-
1
][
'hint'
]
=
hint
class
OpenEndedDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
"""
...
...
lms/templates/open_ended.html
View file @
ef27788c
<section
id=
"openended_${id}"
class=
"openended"
>
<section
id=
"openended_${id}"
class=
"openended"
data-state=
"${state}"
>
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"input_${id}"
class=
"short-form-response"
id=
"input_${id}"
%
if
hidden:
style=
"display:none;"
...
...
@@ -6,13 +6,13 @@
>
${value|h}
</textarea>
<div
class=
"grader-status"
>
% if stat
us == 'unsubmitted
':
% if stat
e == 'initial
':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
>
Unanswered
</span>
% elif stat
us == 'correct
':
% elif stat
e == 'done
':
<span
class=
"correct"
id=
"status_${id}"
>
Correct
</span>
% elif stat
us
== 'incorrect':
% elif stat
e
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
>
Incorrect
</span>
% elif stat
us == 'queued
':
% elif stat
e == 'assessing
':
<span
class=
"grading"
id=
"status_${id}"
>
Submitted for grading
</span>
% 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