Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
d1f13bf9
Commit
d1f13bf9
authored
Feb 05, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed debug state in js and done workaround in poll_module
parent
1b52c6f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
common/lib/xmodule/xmodule/js/src/poll/poll_main.js
+1
-1
common/lib/xmodule/xmodule/poll_module.py
+16
-13
No files found.
common/lib/xmodule/xmodule/js/src/poll/poll_main.js
View file @
d1f13bf9
...
...
@@ -2,7 +2,7 @@
define
(
'PollMain'
,
[
'logme'
],
function
(
logme
)
{
var
debugMode
;
debugMode
=
tru
e
;
debugMode
=
fals
e
;
if
(
debugMode
===
true
)
{
logme
(
'We are in debug mode.'
);
}
...
...
common/lib/xmodule/xmodule/poll_module.py
View file @
d1f13bf9
...
...
@@ -45,9 +45,8 @@ class PollModule(XModule):
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/javascript_loader.coffee'
)],
'js'
:
[
resource_string
(
__name__
,
'js/src/poll/logme.js'
),
resource_string
(
__name__
,
'js/src/poll/poll.js'
),
resource_string
(
__name__
,
'js/src/poll/poll_main.js'
)
]
resource_string
(
__name__
,
'js/src/poll/poll.js'
),
resource_string
(
__name__
,
'js/src/poll/poll_main.js'
)]
}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/poll/display.scss'
)]}
js_module_name
=
"Poll"
...
...
@@ -63,19 +62,23 @@ class PollModule(XModule):
def
handle_ajax
(
self
,
dispatch
,
get
):
''' '''
# import ipdb; ipdb.set_trace()
if
dispatch
in
self
.
poll_answers
:
# and not self.voted:
# self.poll_answers[dispatch] += 1
# workaround
"""Ajax handler.
Args:
dispatch: request slug
get: request get parameters
Returns:
dict
"""
if
dispatch
in
self
.
poll_answers
and
not
self
.
voted
:
tmp
=
{}
for
key
in
self
.
poll_answers
:
tmp
[
key
]
=
self
.
poll_answers
[
key
]
tmp
[
dispatch
]
+=
1
self
.
poll_answers
=
tmp
#end of workaround
self
.
voted
=
True
self
.
poll_answer
=
dispatch
self
.
poll_answers
=
tmp
return
json
.
dumps
({
'poll_answers'
:
self
.
poll_answers
,
'total'
:
sum
(
self
.
poll_answers
.
values
()),
'callback'
:
{
'objectName'
:
'Conditional'
}
...
...
@@ -107,7 +110,7 @@ class PollModule(XModule):
answer
=
element_answer
.
get
(
'id'
,
None
)
if
answer
:
if
answer
not
in
tmp
:
tmp
=
0
tmp
[
answer
]
=
0
answers_to_json
[
answer
]
=
\
cgi
.
escape
(
stringify_children
(
element_answer
))
xml_object_copy
.
remove
(
element_answer
)
...
...
@@ -115,8 +118,8 @@ class PollModule(XModule):
return
json
.
dumps
({
'answers'
:
answers_to_json
,
'question'
:
cgi
.
escape
(
stringify_children
(
xml_object_copy
)),
# to show answered poll after reload:
'poll_answer'
:
self
.
poll_answer
,
'poll_answers
:
'
:
self
.
poll_answers
if
self
.
voted
else
{},
'poll_answer'
:
''
,
#
self.poll_answer,
'poll_answers'
:
self
.
poll_answers
if
self
.
voted
else
{},
'total'
:
sum
(
self
.
poll_answers
.
values
())
if
self
.
voted
else
''
})
...
...
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