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
452074d2
Commit
452074d2
authored
Aug 27, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #69 from open-craft/feedback-icon-only
Only send feedback content to client that should be displayed
parents
612274ab
d5452676
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
49 deletions
+35
-49
mentoring/mcq.py
+12
-23
mentoring/mrq.py
+14
-6
mentoring/public/js/questionnaire.js
+9
-20
No files found.
mentoring/mcq.py
View file @
452074d2
...
...
@@ -53,34 +53,23 @@ class MCQBlock(QuestionnaireAbstractBlock):
log
.
debug
(
u'Received MCQ submission: "
%
s"'
,
submission
)
completed
=
True
tips
=
[]
choices
=
[
choice
.
value
for
choice
in
self
.
custom_choices
]
# ensure rating tips are included
if
self
.
type
==
'rating'
:
choices
+=
[
str
(
n
)
for
n
in
range
(
1
,
6
)]
for
choice
in
choices
:
choice_tips_fragments
=
[]
for
tip
in
self
.
get_tips
():
completed
=
completed
and
self
.
is_tip_completed
(
tip
,
submission
)
if
choice
in
tip
.
display_with_defaults
:
choice_tips_fragments
.
append
(
tip
.
render
())
tips
.
append
({
'choice'
:
choice
,
'tips'
:
render_template
(
'templates/html/tip_choice_group.html'
,
{
'self'
:
self
,
'tips_fragments'
:
choice_tips_fragments
,
'completed'
:
completed
,
})
})
tips_fragments
=
[]
for
tip
in
self
.
get_tips
():
completed
=
completed
and
self
.
is_tip_completed
(
tip
,
submission
)
if
submission
in
tip
.
display_with_defaults
:
tips_fragments
.
append
(
tip
.
render
())
formatted_tips
=
render_template
(
'templates/html/tip_choice_group.html'
,
{
'self'
:
self
,
'tips_fragments'
:
tips_fragments
,
'completed'
:
completed
,
})
self
.
student_choice
=
submission
result
=
{
'submission'
:
submission
,
'completed'
:
completed
,
'tips'
:
tips
,
'tips'
:
formatted_
tips
,
'weight'
:
self
.
weight
,
'score'
:
1
if
completed
else
0
,
}
...
...
mentoring/mrq.py
View file @
452074d2
...
...
@@ -49,6 +49,7 @@ class MRQBlock(QuestionnaireAbstractBlock):
log
.
debug
(
u'Received MRQ submissions: "
%
s"'
,
submissions
)
completed
=
True
score
=
0
results
=
[]
for
choice
in
self
.
custom_choices
:
...
...
@@ -64,16 +65,23 @@ class MRQBlock(QuestionnaireAbstractBlock):
choice_completed
=
False
completed
=
completed
and
choice_completed
results
.
append
({
if
choice_completed
:
score
+=
1
choice_result
=
{
'value'
:
choice
.
value
,
'selected'
:
choice_selected
,
'completed'
:
choice_completed
,
'tips'
:
render_template
(
'templates/html/tip_choice_group.html'
,
{
}
# Only include tips/results in returned response if we want to display them
if
not
self
.
hide_results
:
choice_result
[
'completed'
]
=
choice_completed
choice_result
[
'tips'
]
=
render_template
(
'templates/html/tip_choice_group.html'
,
{
'self'
:
self
,
'tips_fragments'
:
choice_tips_fragments
,
'completed'
:
choice_completed
,
}),
})
})
results
.
append
(
choice_result
)
self
.
student_choices
=
submissions
...
...
@@ -83,7 +91,7 @@ class MRQBlock(QuestionnaireAbstractBlock):
'choices'
:
results
,
'message'
:
self
.
message
,
'weight'
:
self
.
weight
,
'score'
:
sum
(
1.0
for
r
in
results
if
r
[
'completed'
])
/
len
(
results
)
'score'
:
float
(
score
)
/
len
(
results
),
}
log
.
debug
(
u'MRQ submissions result:
%
s'
,
result
)
...
...
mentoring/public/js/questionnaire.js
View file @
452074d2
...
...
@@ -101,11 +101,8 @@ function MCQBlock(runtime, element, mentoring) {
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
}
var
tips
=
_
.
find
(
result
.
tips
,
function
(
obj
)
{
return
obj
.
choice
===
choiceInputDOM
.
val
();
});
if
(
tips
)
{
mentoring
.
setContent
(
choiceTipsDOM
,
tips
.
tips
);
if
(
result
.
tips
)
{
mentoring
.
setContent
(
choiceTipsDOM
,
result
.
tips
);
}
choiceTipsCloseDOM
=
$
(
'.close'
,
choiceTipsDOM
);
...
...
@@ -121,14 +118,7 @@ function MCQBlock(runtime, element, mentoring) {
'<div class="close icon-remove-sign fa-times-circle"></div>'
);
}
else
if
(
result
.
tips
)
{
var
tips
=
_
.
find
(
result
.
tips
,
function
(
obj
)
{
return
obj
.
choice
===
result
.
submission
;
});
if
(
tips
)
{
messageView
.
showMessage
(
tips
.
tips
);
}
else
{
messageView
.
clearPopupEvents
();
}
messageView
.
showMessage
(
result
.
tips
);
}
},
...
...
@@ -194,15 +184,14 @@ function MRQBlock(runtime, element, mentoring) {
}
else
if
(
!
choice
.
completed
)
{
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
}
}
mentoring
.
setContent
(
choiceTipsDOM
,
choice
.
tips
);
choiceTipsCloseDOM
=
$
(
'.close'
,
choiceTipsDOM
);
choiceResultDOM
.
off
(
'click'
).
on
(
'click'
,
function
()
{
messageView
.
showMessage
(
choiceTipsDOM
);
});
mentoring
.
setContent
(
choiceTipsDOM
,
choice
.
tips
);
choiceTipsCloseDOM
=
$
(
'.close'
,
choiceTipsDOM
);
choiceResultDOM
.
off
(
'click'
).
on
(
'click'
,
function
()
{
messageView
.
showMessage
(
choiceTipsDOM
);
});
}
});
},
...
...
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