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
bef01e81
Commit
bef01e81
authored
Sep 26, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY out code that computes current status (correct/partial/incorrect) of step.
parent
1a3602d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
21 deletions
+14
-21
problem_builder/public/js/mentoring_with_steps.js
+2
-2
problem_builder/step.py
+12
-19
No files found.
problem_builder/public/js/mentoring_with_steps.js
View file @
bef01e81
...
@@ -36,9 +36,9 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -36,9 +36,9 @@ function MentoringWithStepsBlock(runtime, element) {
}
}
function
showFeedback
(
response
)
{
function
showFeedback
(
response
)
{
if
(
response
.
completed
===
'correct'
)
{
if
(
response
.
step_status
===
'correct'
)
{
checkmark
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
checkmark
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
}
else
if
(
response
.
completed
===
'partial'
)
{
}
else
if
(
response
.
step_status
===
'partial'
)
{
checkmark
.
addClass
(
'checkmark-partially-correct icon-ok fa-check'
);
checkmark
.
addClass
(
'checkmark-partially-correct icon-ok fa-check'
);
}
else
{
}
else
{
checkmark
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
checkmark
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
...
...
problem_builder/step.py
View file @
bef01e81
...
@@ -142,19 +142,10 @@ class MentoringStepBlock(
...
@@ -142,19 +142,10 @@ class MentoringStepBlock(
for
result
in
submit_results
:
for
result
in
submit_results
:
self
.
student_results
.
append
(
result
)
self
.
student_results
.
append
(
result
)
# Compute "answer status" for this step
if
all
(
result
[
1
][
'status'
]
==
'correct'
for
result
in
submit_results
):
completed
=
Correctness
.
CORRECT
elif
all
(
result
[
1
][
'status'
]
==
'incorrect'
for
result
in
submit_results
):
completed
=
Correctness
.
INCORRECT
else
:
completed
=
Correctness
.
PARTIAL
return
{
return
{
'message'
:
'Success!'
,
'message'
:
'Success!'
,
'
completed'
:
completed
,
'
step_status'
:
self
.
answer_status
,
'results'
:
submit_results
,
'results'
:
submit_results
,
'attempt_complete'
:
self
.
is_last_step
}
}
@XBlock.json_handler
@XBlock.json_handler
...
@@ -166,24 +157,26 @@ class MentoringStepBlock(
...
@@ -166,24 +157,26 @@ class MentoringStepBlock(
result
=
question
.
get_results
(
previous_results
)
result
=
question
.
get_results
(
previous_results
)
results
[
question
.
name
]
=
result
results
[
question
.
name
]
=
result
# Compute "answer status" for this step
if
all
(
result
[
1
][
'status'
]
==
'correct'
for
result
in
self
.
student_results
):
completed
=
Correctness
.
CORRECT
elif
all
(
result
[
1
][
'status'
]
==
'incorrect'
for
result
in
self
.
student_results
):
completed
=
Correctness
.
INCORRECT
else
:
completed
=
Correctness
.
PARTIAL
# Add 'message' to results? Looks like it's not used on the client ...
# Add 'message' to results? Looks like it's not used on the client ...
return
{
return
{
'results'
:
results
,
'results'
:
results
,
'
completed'
:
completed
,
'
step_status'
:
self
.
answer_status
,
}
}
def
reset
(
self
):
def
reset
(
self
):
while
self
.
student_results
:
while
self
.
student_results
:
self
.
student_results
.
pop
()
self
.
student_results
.
pop
()
@property
def
answer_status
(
self
):
if
all
(
result
[
1
][
'status'
]
==
'correct'
for
result
in
self
.
student_results
):
answer_status
=
Correctness
.
CORRECT
elif
all
(
result
[
1
][
'status'
]
==
'incorrect'
for
result
in
self
.
student_results
):
answer_status
=
Correctness
.
INCORRECT
else
:
answer_status
=
Correctness
.
PARTIAL
return
answer_status
def
author_edit_view
(
self
,
context
):
def
author_edit_view
(
self
,
context
):
"""
"""
Add some HTML to the author view that allows authors to add child blocks.
Add some HTML to the author view that allows authors to add child blocks.
...
...
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