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
625169c2
Commit
625169c2
authored
May 19, 2015
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Making MRQ feedback persistence in line with ordinary submission
parent
2615f20c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
16 deletions
+49
-16
problem_builder/mrq.py
+4
-6
problem_builder/tests/integration/test_mentoring.py
+45
-10
No files found.
problem_builder/mrq.py
View file @
625169c2
...
...
@@ -81,17 +81,17 @@ class MRQBlock(QuestionnaireAbstractBlock):
return
self
.
_
(
u"Ignored"
)
return
self
.
_
(
u"Not Acceptable"
)
def
get_results
(
self
,
previous_result
,
only_selected
=
False
):
def
get_results
(
self
,
previous_result
):
"""
Get the results a student has already submitted.
"""
result
=
self
.
calculate_results
(
previous_result
[
'submissions'
]
,
only_selected
)
result
=
self
.
calculate_results
(
previous_result
[
'submissions'
])
result
[
'completed'
]
=
True
return
result
def
get_last_result
(
self
):
if
self
.
student_choices
:
return
self
.
get_results
({
'submissions'
:
self
.
student_choices
}
,
only_selected
=
True
)
return
self
.
get_results
({
'submissions'
:
self
.
student_choices
})
else
:
return
{}
...
...
@@ -104,7 +104,7 @@ class MRQBlock(QuestionnaireAbstractBlock):
log
.
debug
(
u'MRQ submissions result:
%
s'
,
result
)
return
result
def
calculate_results
(
self
,
submissions
,
only_selected
=
False
):
def
calculate_results
(
self
,
submissions
):
score
=
0
results
=
[]
...
...
@@ -112,8 +112,6 @@ class MRQBlock(QuestionnaireAbstractBlock):
choice_completed
=
True
choice_tips_html
=
[]
choice_selected
=
choice
.
value
in
submissions
if
not
choice_selected
and
only_selected
:
continue
if
choice
.
value
in
self
.
required_choices
:
if
not
choice_selected
:
...
...
problem_builder/tests/integration/test_mentoring.py
View file @
625169c2
...
...
@@ -146,20 +146,17 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
if
checkbox
.
is_selected
():
checkbox
.
click
()
def
_standard_checks
(
self
,
answer
,
mcq
,
mrq
,
rating
,
messages
,
only_selected
=
False
):
def
_standard_checks
(
self
,
answer
,
mcq
,
mrq
,
rating
,
messages
):
self
.
assertEqual
(
answer
.
get_attribute
(
'value'
),
'This is the answer'
)
self
.
_assert_feedback_showed
(
mcq
,
0
,
"Great!"
)
self
.
_assert_feedback_showed
(
mrq
,
0
,
"This is something everyone has to like about this MRQ"
,
click_choice_result
=
True
)
if
not
only_selected
:
self
.
_assert_feedback_showed
(
mrq
,
1
,
"This is something everyone has to like about beauty"
,
click_choice_result
=
True
,
success
=
False
)
else
:
self
.
_assert_feedback_hidden
(
mrq
,
1
)
self
.
_assert_feedback_showed
(
mrq
,
1
,
"This is something everyone has to like about beauty"
,
click_choice_result
=
True
,
success
=
False
)
self
.
_assert_feedback_showed
(
mrq
,
2
,
"This MRQ is indeed very graceful"
,
click_choice_result
=
True
)
self
.
_assert_feedback_showed
(
mrq
,
3
,
"Nah, there aren't any!"
,
click_choice_result
=
True
,
success
=
False
)
self
.
_assert_feedback_showed
(
rating
,
3
,
"I love good grades."
,
click_choice_result
=
True
)
...
...
@@ -199,7 +196,7 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
messages
=
self
.
_get_messages_element
(
mentoring
)
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
self
.
_standard_checks
(
answer
,
mcq
,
mrq
,
rating
,
messages
,
only_selected
=
True
)
self
.
_standard_checks
(
answer
,
mcq
,
mrq
,
rating
,
messages
)
# after reloading submit is disabled...
self
.
assertFalse
(
submit
.
is_enabled
())
...
...
@@ -247,4 +244,42 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
mentoring
=
self
.
go_to_view
(
"student_view"
)
answer
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
self
.
_standard_checks
(
answer
,
mcq
,
mrq
,
rating
,
messages
,
only_selected
=
True
)
self
.
_standard_checks
(
answer
,
mcq
,
mrq
,
rating
,
messages
)
def
test_partial_mrq_is_not_completed
(
self
):
mentoring
=
self
.
load_scenario
(
"feedback_persistence.xml"
)
answer
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
answer
.
send_keys
(
'This is the answer'
)
self
.
click_choice
(
mcq
,
"Yes"
)
# 1st, 3rd and 4th options, first three are correct, i.e. two mistakes: 2nd and 4th
self
.
click_choice
(
mrq
,
"Its elegance"
)
self
.
click_choice
(
mrq
,
"Its gracefulness"
)
self
.
click_choice
(
rating
,
"4"
)
self
.
click_submit
(
mentoring
)
def
assert_state
(
answer
,
mcq
,
mrq
,
rating
,
messages
):
self
.
assertEqual
(
answer
.
get_attribute
(
'value'
),
'This is the answer'
)
self
.
_assert_feedback_showed
(
mcq
,
0
,
"Great!"
)
self
.
_assert_feedback_showed
(
mrq
,
0
,
"This is something everyone has to like about this MRQ"
,
click_choice_result
=
True
)
self
.
_assert_feedback_showed
(
mrq
,
1
,
"This is something everyone has to like about beauty"
,
click_choice_result
=
True
,
success
=
False
)
self
.
_assert_feedback_showed
(
mrq
,
2
,
"This MRQ is indeed very graceful"
,
click_choice_result
=
True
)
self
.
_assert_feedback_showed
(
mrq
,
3
,
"Nah, there aren't any!"
,
click_choice_result
=
True
)
self
.
_assert_feedback_showed
(
rating
,
3
,
"I love good grades."
,
click_choice_result
=
True
)
self
.
assertTrue
(
messages
.
is_displayed
())
self
.
assertEqual
(
messages
.
text
,
"FEEDBACK
\n
Not done yet"
)
assert_state
(
answer
,
mcq
,
mrq
,
rating
,
messages
)
# now, reload the page and make sure the same result is shown
mentoring
=
self
.
go_to_view
(
"student_view"
)
answer
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
assert_state
(
answer
,
mcq
,
mrq
,
rating
,
messages
)
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