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