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
59d2b222
Commit
59d2b222
authored
Jan 24, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to get mentoring assessments working.
parent
6598d2b0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
26 deletions
+28
-26
mentoring/mentoring.py
+7
-7
mentoring/public/js/mentoring.js
+8
-1
mentoring/public/js/mentoring_assessment_view.js
+12
-17
mentoring/public/js/mentoring_standard_view.js
+1
-1
No files found.
mentoring/mentoring.py
View file @
59d2b222
...
...
@@ -37,7 +37,7 @@ from xblock.fragment import Fragment
from
components.title
import
TitleBlock
from
components.header
import
SharedHeaderBlock
from
components.message
import
MentoringMessageBlock
from
components.step
import
StepParentMixin
from
components.step
import
StepParentMixin
,
StepMixin
from
xblockutils.resources
import
ResourceLoader
...
...
@@ -375,8 +375,9 @@ class MentoringBlock(XBlock, StepParentMixin):
completed
=
False
current_child
=
None
children
=
[
child
for
child
in
self
.
get_children_objects
()
if
not
isinstance
(
child
,
self
.
FLOATING_BLOCKS
)]
children
=
[
self
.
runtime
.
get_block
(
child_id
)
for
child_id
in
self
.
children
]
children
=
[
child
for
child
in
children
if
not
isinstance
(
child
,
self
.
FLOATING_BLOCKS
)]
steps
=
[
child
for
child
in
children
if
isinstance
(
child
,
StepMixin
)]
# Faster than the self.steps property
for
child
in
children
:
if
child
.
name
and
child
.
name
in
submissions
:
...
...
@@ -385,7 +386,7 @@ class MentoringBlock(XBlock, StepParentMixin):
# Assessment mode doesn't allow to modify answers
# This will get the student back at the step he should be
current_child
=
child
step
=
children
.
index
(
child
)
step
=
steps
.
index
(
child
)
if
self
.
step
>
step
or
self
.
max_attempts_reached
:
step
=
self
.
step
completed
=
False
...
...
@@ -397,14 +398,13 @@ class MentoringBlock(XBlock, StepParentMixin):
if
'tips'
in
child_result
:
del
child_result
[
'tips'
]
self
.
student_results
.
append
([
child
.
name
,
child_result
])
child
.
save
()
completed
=
child_result
[
'status'
]
event_data
=
{}
score
=
self
.
score
if
current_child
==
s
elf
.
s
teps
[
-
1
]:
if
current_child
==
steps
[
-
1
]:
log
.
info
(
u'Last assessment step submitted: {}'
.
format
(
submissions
))
if
not
self
.
max_attempts_reached
:
self
.
runtime
.
publish
(
self
,
'grade'
,
{
...
...
@@ -421,7 +421,7 @@ class MentoringBlock(XBlock, StepParentMixin):
event_data
[
'num_attempts'
]
=
self
.
num_attempts
event_data
[
'submitted_answer'
]
=
submissions
self
.
publish_event_from_dict
(
'xblock.mentoring.assessment.submitted'
,
event_data
)
self
.
runtime
.
publish
(
self
,
'xblock.mentoring.assessment.submitted'
,
event_data
)
return
{
'completed'
:
completed
,
...
...
mentoring/public/js/mentoring.js
View file @
59d2b222
...
...
@@ -12,6 +12,7 @@ function MentoringBlock(runtime, element) {
children
:
children
,
initChildren
:
initChildren
,
getChildByName
:
getChildByName
,
hideAllChildren
:
hideAllChildren
,
step
:
step
,
publish_event
:
publish_event
};
...
...
@@ -87,7 +88,13 @@ function MentoringBlock(runtime, element) {
}
}
function
getChildByName
(
element
,
name
)
{
function
hideAllChildren
()
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
$
(
children
[
i
].
element
).
hide
();
}
}
function
getChildByName
(
name
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
child
=
children
[
i
];
if
(
child
&&
child
.
name
===
name
)
{
...
...
mentoring/public/js/mentoring_assessment_view.js
View file @
59d2b222
...
...
@@ -13,8 +13,8 @@ function MentoringAssessmentView(runtime, element, mentoring) {
checkmark
.
removeClass
(
'checkmark-partially-correct icon-ok fa-check'
);
checkmark
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
/
* hide all children */
$
(
':nth-child(2)'
,
mentoring
.
children_dom
).
remove
();
/
/ hide all children
mentoring
.
hideAllChildren
();
$
(
'.grade'
).
html
(
''
);
$
(
'.attempts'
).
html
(
''
);
...
...
@@ -77,7 +77,11 @@ function MentoringAssessmentView(runtime, element, mentoring) {
tryAgainDOM
.
bind
(
'click'
,
tryAgain
);
active_child
=
mentoring
.
step
-
1
;
mentoring
.
readChildren
();
var
options
=
{
onChange
:
onChange
};
mentoring
.
initChildren
(
options
);
displayNextChild
();
mentoring
.
renderDependency
();
...
...
@@ -92,24 +96,16 @@ function MentoringAssessmentView(runtime, element, mentoring) {
}
function
displayNextChild
()
{
var
options
=
{
onChange
:
onChange
};
cleanAll
();
// find the next real child block to display. HTMLBlock are always displayed
++
active_child
;
while
(
1
)
{
var
child
=
mentoring
.
displayChild
(
active_child
,
options
);
active_child
++
;
var
child
=
mentoring
.
children
[
active_child
];
$
(
child
.
element
).
show
(
);
mentoring
.
publish_event
({
event_type
:
'xblock.mentoring.assessment.shown'
,
exercise_id
:
$
(
child
).
attr
(
'name'
)
exercise_id
:
child
.
name
});
if
((
typeof
child
!==
'undefined'
)
||
active_child
==
mentoring
.
children
.
length
-
1
)
break
;
++
active_child
;
}
if
(
isDone
())
renderGrade
();
...
...
@@ -151,8 +147,7 @@ function MentoringAssessmentView(runtime, element, mentoring) {
if
(
result
.
step
!=
active_child
+
1
)
{
active_child
=
result
.
step
-
1
;
displayNextChild
();
}
else
{
}
else
{
nextDOM
.
removeAttr
(
"disabled"
);
reviewDOM
.
removeAttr
(
"disabled"
);
}
...
...
mentoring/public/js/mentoring_standard_view.js
View file @
59d2b222
...
...
@@ -10,7 +10,7 @@ function MentoringStandardView(runtime, element, mentoring) {
$
.
each
(
results
.
submitResults
||
[],
function
(
index
,
submitResult
)
{
var
input
=
submitResult
[
0
];
var
result
=
submitResult
[
1
];
var
child
=
mentoring
.
getChildByName
(
element
,
input
);
var
child
=
mentoring
.
getChildByName
(
input
);
var
options
=
{
max_attempts
:
results
.
max_attempts
,
num_attempts
:
results
.
num_attempts
...
...
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