Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-poll
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
edx
xblock-poll
Commits
0b0895e4
Commit
0b0895e4
authored
Jan 12, 2015
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve event data and response display for surveys.
parent
1e409383
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
poll/poll.py
+8
-4
poll/public/handlebars/survey_results.handlebars
+8
-6
No files found.
poll/poll.py
View file @
0b0895e4
...
...
@@ -49,9 +49,12 @@ class PollBase(XBlock, ResourceMixin, PublishEventMixin):
'max_value'
:
1
,
}
)
# The SDK doesn't set url_name.
event_dict
=
{
'url_name'
:
getattr
(
self
,
'url_name'
,
''
)}
event_dict
.
update
(
choice_data
)
self
.
publish_event_from_dict
(
self
.
event_namespace
+
'.submitted'
,
choice_data
,
event_dict
,
)
@staticmethod
...
...
@@ -466,11 +469,12 @@ class SurveyBlock(PollBase):
answer_set
=
OrderedDict
(
default_answers
)
answer_set
.
update
(
source_tally
[
key
])
tally
.
append
({
'text'
:
value
[
'label'
],
'label'
:
value
[
'label'
],
'img'
:
value
[
'img'
],
'answers'
:
[
{
'count'
:
count
,
'choice'
:
False
,
'key'
:
answer_key
,
'top'
:
False
'key'
:
answer_key
,
'top'
:
False
,
}
for
answer_key
,
count
in
answer_set
.
items
()],
'key'
:
key
,
...
...
@@ -625,7 +629,7 @@ class SurveyBlock(PollBase):
for
key
,
value
in
self
.
choices
.
items
():
self
.
tally
[
key
][
value
]
+=
1
self
.
send_vote_event
({
'choices'
:
choices
})
self
.
send_vote_event
({
'choices'
:
self
.
choices
})
return
result
...
...
poll/public/handlebars/survey_results.handlebars
View file @
0b0895e4
...
...
@@ -11,12 +11,14 @@
<
/thead
>
{{#
each
tally
}}
<
tr
class
=
"survey-row"
>
{{#if
img
}}
<
div
class
=
"poll-image-td"
>
<
img
src
=
"
{{
img
}}
"
/>
<
/div
>
{{/if}}
<
td
class
=
"survey-question"
>
{{{
text
}}}
<
/td
>
<
td
class
=
"survey-question"
>
{{#if
img
}}
<
div
class
=
"poll-image-td"
>
<
img
src
=
"
{{
img
}}
"
/>
<
/div
>
{{/if}}
{{{
label
}}}
<
/td
>
{{#
each
answers
}}
<
td
class
=
"survey-percentage survey-option
{{#if
choice
}}
survey-choice
{{/if}}{{#if
top
}}
poll-top-choice
{{/if}}
"
>
{{
percent
}}
%<
/td
>
{{/
each
}}
...
...
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