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
0d627346
Commit
0d627346
authored
Sep 25, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display step- and answer-level feedback when reviewing step.
parent
67a9c25f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
1 deletions
+92
-1
problem_builder/public/js/mentoring_with_steps.js
+38
-0
problem_builder/public/js/step.js
+31
-1
problem_builder/step.py
+23
-0
No files found.
problem_builder/public/js/mentoring_with_steps.js
View file @
0d627346
...
@@ -111,6 +111,29 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -111,6 +111,29 @@ function MentoringWithStepsBlock(runtime, element) {
step
.
submit
(
handleResults
);
step
.
submit
(
handleResults
);
}
}
function
getResults
()
{
var
step
=
steps
[
activeStep
];
step
.
getResults
(
handleReviewResults
);
}
function
handleReviewResults
(
response
)
{
// Show step-level feedback
if
(
response
.
completed
===
'correct'
)
{
checkmark
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
}
else
if
(
response
.
completed
===
'partial'
)
{
checkmark
.
addClass
(
'checkmark-partially-correct icon-ok fa-check'
);
}
else
{
checkmark
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
}
// Forward to active step to show answer level feedback
var
step
=
steps
[
activeStep
];
var
results
=
response
.
results
;
var
options
=
{
checkmark
:
checkmark
};
step
.
handleReview
(
results
,
options
);
}
function
hideAllSteps
()
{
function
hideAllSteps
()
{
for
(
var
i
=
0
;
i
<
steps
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
steps
.
length
;
i
++
)
{
$
(
steps
[
i
].
element
).
hide
();
$
(
steps
[
i
].
element
).
hide
();
...
@@ -216,6 +239,8 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -216,6 +239,8 @@ function MentoringWithStepsBlock(runtime, element) {
submitDOM
.
attr
(
'disabled'
,
'disabled'
);
submitDOM
.
attr
(
'disabled'
,
'disabled'
);
reviewLinkDOM
.
show
();
reviewLinkDOM
.
show
();
// ...
// ...
getResults
();
}
}
function
showAttempts
()
{
function
showAttempts
()
{
...
@@ -258,10 +283,23 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -258,10 +283,23 @@ function MentoringWithStepsBlock(runtime, element) {
function
initSteps
(
options
)
{
function
initSteps
(
options
)
{
for
(
var
i
=
0
;
i
<
steps
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
steps
.
length
;
i
++
)
{
var
step
=
steps
[
i
];
var
step
=
steps
[
i
];
var
mentoring
=
{
setContent
:
setContent
};
options
.
mentoring
=
mentoring
;
step
.
initChildren
(
options
);
step
.
initChildren
(
options
);
}
}
}
}
function
setContent
(
dom
,
content
)
{
dom
.
html
(
''
);
dom
.
append
(
content
);
var
template
=
$
(
'#light-child-template'
,
dom
).
html
();
if
(
template
)
{
dom
.
append
(
template
);
}
}
function
showGrade
()
{
function
showGrade
()
{
cleanAll
();
cleanAll
();
showAssessmentMessage
();
showAssessmentMessage
();
...
...
problem_builder/public/js/step.js
View file @
0d627346
function
MentoringStepBlock
(
runtime
,
element
)
{
function
MentoringStepBlock
(
runtime
,
element
)
{
var
children
=
runtime
.
children
(
element
);
var
children
=
runtime
.
children
(
element
);
var
submitXHR
;
var
submitXHR
,
resultsXHR
;
function
callIfExists
(
obj
,
fn
)
{
function
callIfExists
(
obj
,
fn
)
{
if
(
typeof
obj
!==
'undefined'
&&
typeof
obj
[
fn
]
==
'function'
)
{
if
(
typeof
obj
!==
'undefined'
&&
typeof
obj
[
fn
]
==
'function'
)
{
...
@@ -51,6 +51,36 @@ function MentoringStepBlock(runtime, element) {
...
@@ -51,6 +51,36 @@ function MentoringStepBlock(runtime, element) {
.
success
(
function
(
response
)
{
.
success
(
function
(
response
)
{
result_handler
(
response
);
result_handler
(
response
);
});
});
},
getResults
:
function
(
result_handler
)
{
var
handler_name
=
'get_results'
;
var
data
=
[];
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
child
=
children
[
i
];
if
(
child
&&
child
.
name
!==
undefined
)
{
// Check if we are dealing with a question
data
[
i
]
=
child
.
name
;
}
}
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
handler_name
);
if
(
resultsXHR
)
{
resultsXHR
.
abort
();
}
resultsXHR
=
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
data
))
.
success
(
function
(
response
)
{
result_handler
(
response
);
});
},
handleReview
:
function
(
results
,
options
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
child
=
children
[
i
];
if
(
child
&&
child
.
name
!==
undefined
)
{
// Check if we are dealing with a question
var
result
=
results
[
child
.
name
];
callIfExists
(
child
,
'handleSubmit'
,
result
,
options
);
callIfExists
(
child
,
'handleReview'
,
result
);
}
}
}
}
};
};
...
...
problem_builder/step.py
View file @
0d627346
...
@@ -157,6 +157,29 @@ class MentoringStepBlock(
...
@@ -157,6 +157,29 @@ class MentoringStepBlock(
'attempt_complete'
:
self
.
is_last_step
'attempt_complete'
:
self
.
is_last_step
}
}
@XBlock.json_handler
def
get_results
(
self
,
queries
,
suffix
=
''
):
results
=
{}
answers
=
dict
(
self
.
student_results
)
for
question
in
self
.
get_steps
():
previous_results
=
answers
[
question
.
name
]
result
=
question
.
get_results
(
previous_results
)
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 ...
return
{
'results'
:
results
,
'completed'
:
completed
,
}
def
reset
(
self
):
def
reset
(
self
):
while
self
.
student_results
:
while
self
.
student_results
:
self
.
student_results
.
pop
()
self
.
student_results
.
pop
()
...
...
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