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
742c2238
Commit
742c2238
authored
May 08, 2015
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Showing feedback for last submission
parent
bfd829e9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
19 deletions
+16
-19
problem_builder/answer.py
+3
-0
problem_builder/mcq.py
+3
-0
problem_builder/mentoring.py
+5
-9
problem_builder/mrq.py
+3
-0
problem_builder/tests/integration/base_test.py
+0
-7
problem_builder/tests/integration/test_mentoring.py
+2
-3
No files found.
problem_builder/answer.py
View file @
742c2238
...
@@ -189,6 +189,9 @@ class AnswerBlock(AnswerMixin, StepMixin, StudioEditableXBlockMixin, XBlock):
...
@@ -189,6 +189,9 @@ class AnswerBlock(AnswerMixin, StepMixin, StudioEditableXBlockMixin, XBlock):
'score'
:
1
if
self
.
status
==
'correct'
else
0
,
'score'
:
1
if
self
.
status
==
'correct'
else
0
,
}
}
def
get_last_result
(
self
):
return
self
.
get_results
(
None
)
def
submit
(
self
,
submission
):
def
submit
(
self
,
submission
):
"""
"""
The parent block is handling a student submission, including a new answer for this
The parent block is handling a student submission, including a new answer for this
...
...
problem_builder/mcq.py
View file @
742c2238
...
@@ -105,6 +105,9 @@ class MCQBlock(SubmittingXBlockMixin, QuestionnaireAbstractBlock):
...
@@ -105,6 +105,9 @@ class MCQBlock(SubmittingXBlockMixin, QuestionnaireAbstractBlock):
def
get_results
(
self
,
previous_result
):
def
get_results
(
self
,
previous_result
):
return
self
.
calculate_results
(
previous_result
[
'submission'
])
return
self
.
calculate_results
(
previous_result
[
'submission'
])
def
get_last_result
(
self
):
return
self
.
get_results
({
'submission'
:
self
.
student_choice
})
if
self
.
student_choice
else
{}
def
submit
(
self
,
submission
):
def
submit
(
self
,
submission
):
log
.
debug
(
u'Received MCQ submission: "
%
s"'
,
submission
)
log
.
debug
(
u'Received MCQ submission: "
%
s"'
,
submission
)
result
=
self
.
calculate_results
(
submission
)
result
=
self
.
calculate_results
(
submission
)
...
...
problem_builder/mentoring.py
View file @
742c2238
...
@@ -470,19 +470,15 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
...
@@ -470,19 +470,15 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
Gets previous submissions results as if submit was called with exactly the same values as last time.
Gets previous submissions results as if submit was called with exactly the same values as last time.
"""
"""
results
=
[]
results
=
[]
completed
,
show_message
=
True
,
Fals
e
completed
=
Tru
e
choices
=
dict
(
self
.
student_results
)
show_message
=
bool
(
self
.
student_results
)
# In standard mode, all children is visible simultaneously, so need collecting responses from all of them
# In standard mode, all children is visible simultaneously, so need collecting responses from all of them
for
child_id
in
self
.
steps
:
for
child_id
in
self
.
steps
:
child
=
self
.
runtime
.
get_block
(
child_id
)
child
=
self
.
runtime
.
get_block
(
child_id
)
if
child
.
name
and
child
.
name
in
choices
:
child_result
=
child
.
get_last_result
()
show_message
=
True
results
.
append
([
child
.
name
,
child_result
])
child_result
=
child
.
get_results
(
choices
[
child
.
name
])
completed
=
completed
and
(
child_result
.
get
(
'status'
,
None
)
==
'correct'
)
results
.
append
([
child
.
name
,
child_result
])
completed
=
completed
and
(
child_result
[
'status'
]
==
'correct'
)
else
:
completed
=
False
return
results
,
completed
,
show_message
return
results
,
completed
,
show_message
...
...
problem_builder/mrq.py
View file @
742c2238
...
@@ -89,6 +89,9 @@ class MRQBlock(QuestionnaireAbstractBlock):
...
@@ -89,6 +89,9 @@ class MRQBlock(QuestionnaireAbstractBlock):
result
[
'completed'
]
=
True
result
[
'completed'
]
=
True
return
result
return
result
def
get_last_result
(
self
):
return
self
.
get_results
({
'submissions'
:
self
.
student_choices
})
if
self
.
student_choices
else
{}
def
submit
(
self
,
submissions
):
def
submit
(
self
,
submissions
):
log
.
debug
(
u'Received MRQ submissions: "
%
s"'
,
submissions
)
log
.
debug
(
u'Received MRQ submissions: "
%
s"'
,
submissions
)
...
...
problem_builder/tests/integration/base_test.py
View file @
742c2238
...
@@ -87,13 +87,6 @@ class ProblemBuilderBaseTest(SeleniumXBlockTest, PopupCheckMixin):
...
@@ -87,13 +87,6 @@ class ProblemBuilderBaseTest(SeleniumXBlockTest, PopupCheckMixin):
def
click_choice
(
self
,
container
,
choice_text
):
def
click_choice
(
self
,
container
,
choice_text
):
""" Click on the choice label with the specified text """
""" Click on the choice label with the specified text """
for
label
in
container
.
find_elements_by_css_selector
(
'.choices .choice label'
):
if
choice_text
in
label
.
text
:
label
.
click
()
break
def
click_choice
(
self
,
container
,
choice_text
):
""" Click on the choice label with the specified text """
for
label
in
container
.
find_elements_by_css_selector
(
'.choice label'
):
for
label
in
container
.
find_elements_by_css_selector
(
'.choice label'
):
if
choice_text
in
label
.
text
:
if
choice_text
in
label
.
text
:
label
.
click
()
label
.
click
()
...
...
problem_builder/tests/integration/test_mentoring.py
View file @
742c2238
...
@@ -159,7 +159,7 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
...
@@ -159,7 +159,7 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
def
test_feedbacks_and_messages_is_not_shown_on_first_load
(
self
):
def
test_feedbacks_and_messages_is_not_shown_on_first_load
(
self
):
mentoring
=
self
.
load_scenario
(
"feedback_persistence.xml"
)
mentoring
=
self
.
load_scenario
(
"feedback_persistence.xml"
)
answer
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
_
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
for
i
in
range
(
3
):
for
i
in
range
(
3
):
...
@@ -225,4 +225,4 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
...
@@ -225,4 +225,4 @@ class ProblemBuilderQuestionnaireBlockTest(ProblemBuilderBaseTest):
mentoring
=
self
.
go_to_view
(
"student_view"
)
mentoring
=
self
.
go_to_view
(
"student_view"
)
answer
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
answer
,
mcq
,
mrq
,
rating
=
self
.
_get_controls
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
messages
=
self
.
_get_messages_element
(
mentoring
)
self
.
_standard_checks
(
answer
,
mcq
,
mrq
,
rating
,
messages
)
self
.
_standard_checks
(
answer
,
mcq
,
mrq
,
rating
,
messages
)
\ No newline at end of file
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