Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
963b4b96
Commit
963b4b96
authored
Jan 04, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes blank read only answers which were preventing completion
parent
e6e6962e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletions
+31
-1
mentoring/answer.py
+5
-1
tests/test_answer.py
+21
-0
tests/xml/answer_blank_read_only.xml
+5
-0
No files found.
mentoring/answer.py
View file @
963b4b96
...
...
@@ -86,9 +86,13 @@ class AnswerBlock(XBlock):
log
.
info
(
u'Answer submitted for`{}`: "{}"'
.
format
(
self
.
name
,
self
.
student_input
))
return
{
'student_input'
:
self
.
student_input
,
'completed'
:
bool
(
self
.
student_input
)
,
'completed'
:
self
.
completed
,
}
@property
def
completed
(
self
):
return
bool
(
self
.
read_only
or
self
.
student_input
)
def
save
(
self
):
"""
Replicate data changes on the related Django model used for sharing of data accross XBlocks
...
...
tests/test_answer.py
View file @
963b4b96
...
...
@@ -9,6 +9,9 @@ from mentoring.test_base import MentoringBaseTest
class
AnswerBlockTest
(
MentoringBaseTest
):
def
test_answer_edit
(
self
):
"""
Answers of same name should share value accross blocks
"""
# Answer should initially be blank on all instances with the same answer name
mentoring
=
self
.
go_to_page
(
'Answer Edit 2'
)
answer1_bis
=
mentoring
.
find_element_by_css_selector
(
'.xblock textarea'
)
...
...
@@ -53,3 +56,21 @@ class AnswerBlockTest(MentoringBaseTest):
answer1_readonly
=
mentoring
.
find_element_by_css_selector
(
'blockquote.answer.read_only'
)
self
.
assertEqual
(
answer1_bis
.
get_attribute
(
'value'
),
'This is the answer'
)
self
.
assertEqual
(
answer1_readonly
.
text
,
'This is the answer'
)
def
test_answer_blank_read_only
(
self
):
"""
Read-only answers should not prevent completion when blank
"""
# Check initial state
mentoring
=
self
.
go_to_page
(
'Answer Blank Read Only'
)
answer
=
mentoring
.
find_element_by_css_selector
(
'blockquote.answer.read_only'
)
self
.
assertEqual
(
answer
.
text
,
''
)
progress
=
mentoring
.
find_element_by_css_selector
(
'.progress > .indicator'
)
self
.
assertEqual
(
progress
.
text
,
'(Not completed)'
)
# Submit should allow to complete
submit
=
mentoring
.
find_element_by_css_selector
(
'input.submit'
)
submit
.
click
()
self
.
assertEqual
(
progress
.
text
,
''
)
self
.
assertTrue
(
progress
.
find_elements_by_css_selector
(
'img'
))
tests/xml/answer_blank_read_only.xml
0 → 100644
View file @
963b4b96
<vertical>
<mentoring
url_name=
"answer_blank_read_only"
enforce_dependency=
"false"
>
<answer
name=
"answer_blank"
read_only=
"true"
/>
</mentoring>
</vertical>
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