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
6e5a6f97
Commit
6e5a6f97
authored
Nov 12, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make textboxes read-only when that makes sense.
- also make reset hide the original output
parent
39210fa9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
11 deletions
+25
-11
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
+7
-2
common/lib/xmodule/xmodule/self_assessment_module.py
+18
-9
No files found.
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
View file @
6e5a6f97
...
...
@@ -21,7 +21,6 @@ class @SelfAssessment
@
find_assessment_elements
()
@
find_hint_elements
()
@
rebind
()
# locally scoped jquery.
...
...
@@ -33,16 +32,22 @@ class @SelfAssessment
@
submit_button
.
unbind
(
'click'
)
@
submit_button
.
show
()
@
reset_button
.
hide
()
@
hint_area
.
attr
(
'disabled'
,
false
)
if
@
state
==
'initial'
@
answer_area
.
attr
(
"disabled"
,
false
)
@
submit_button
.
prop
(
'value'
,
'Submit'
)
@
submit_button
.
click
@
save_answer
else
if
@
state
==
'assessing'
@
answer_area
.
attr
(
"disabled"
,
true
)
@
submit_button
.
prop
(
'value'
,
'Submit assessment'
)
@
submit_button
.
click
@
save_assessment
else
if
@
state
==
'request_hint'
@
answer_area
.
attr
(
"disabled"
,
true
)
@
submit_button
.
prop
(
'value'
,
'Submit hint'
)
@
submit_button
.
click
@
save_hint
else
if
@
state
==
'done'
@
answer_area
.
attr
(
"disabled"
,
true
)
@
hint_area
.
attr
(
'disabled'
,
true
)
@
submit_button
.
hide
()
if
@
allow_reset
@
reset_button
.
show
()
...
...
@@ -62,7 +67,6 @@ class @SelfAssessment
data
=
{
'student_answer'
:
@
answer_area
.
val
()}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/save_answer"
,
data
,
(
response
)
=>
if
response
.
success
@
answer_area
.
attr
(
"disabled"
,
true
)
@
rubric_wrapper
.
html
(
response
.
rubric_html
)
@
state
=
'assessing'
@
find_assessment_elements
()
...
...
@@ -110,6 +114,7 @@ class @SelfAssessment
if
@
state
==
'done'
$
.
postWithPrefix
"
#{
@
ajax_url
}
/reset"
,
{},
(
response
)
=>
if
response
.
success
@
answer_area
.
html
(
''
)
@
rubric_wrapper
.
html
(
''
)
@
hint_wrapper
.
html
(
''
)
@
message_wrapper
.
html
(
''
)
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
6e5a6f97
...
...
@@ -125,7 +125,10 @@ class SelfAssessmentModule(XModule):
def
get_html
(
self
):
#set context variables and render template
previous_answer
=
self
.
student_answers
[
-
1
]
if
self
.
student_answers
else
''
if
self
.
state
!=
self
.
INITIAL
and
self
.
student_answers
:
previous_answer
=
self
.
student_answers
[
-
1
]
else
:
previous_answer
=
''
allow_reset
=
self
.
state
==
self
.
DONE
and
self
.
attempts
<
self
.
max_attempts
context
=
{
...
...
@@ -207,12 +210,12 @@ class SelfAssessmentModule(XModule):
})
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
out_of_sync_error
(
self
,
get
):
def
out_of_sync_error
(
self
,
get
,
msg
=
''
):
"""
return dict out-of-sync error message, and also log.
"""
log
.
warning
(
"Assessment module state out sync. state:
%
r, get:
%
r"
,
self
.
state
,
get
)
log
.
warning
(
"Assessment module state out sync. state:
%
r, get:
%
r
.
%
s
"
,
self
.
state
,
get
,
msg
)
return
{
'success'
:
False
,
'error'
:
'The problem state got out-of-sync'
}
...
...
@@ -244,8 +247,12 @@ class SelfAssessmentModule(XModule):
if
self
.
state
in
(
self
.
INITIAL
,
self
.
ASSESSING
):
return
''
# else we'll render it
hint
=
self
.
hints
[
-
1
]
if
len
(
self
.
hints
)
>
0
else
''
if
self
.
state
==
self
.
REQUEST_HINT
and
len
(
self
.
hints
)
>
0
:
# display the previous hint
hint
=
self
.
hints
[
-
1
]
else
:
hint
=
''
context
=
{
'hint_prompt'
:
self
.
hint_prompt
,
'hint'
:
hint
}
...
...
@@ -301,9 +308,11 @@ class SelfAssessmentModule(XModule):
with 'error' only present if 'success' is False, and 'hint_html' only if success is true
"""
if
(
self
.
state
!=
self
.
ASSESSING
or
len
(
self
.
student_answers
)
!=
len
(
self
.
scores
)
+
1
):
return
self
.
out_of_sync_error
(
get
)
n_answers
=
len
(
self
.
student_answers
)
n_scores
=
len
(
self
.
scores
)
if
(
self
.
state
!=
self
.
ASSESSING
or
n_answers
!=
n_scores
+
1
):
msg
=
"
%
d answers,
%
d scores"
%
(
n_answers
,
n_scores
)
return
self
.
out_of_sync_error
(
get
,
msg
)
try
:
self
.
scores
.
append
(
int
(
get
[
'assessment'
]))
...
...
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