Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 3b60d98

Browse files
committed
Bug fixes for showing results
1 parent f07d8f3 commit 3b60d98

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

runestone/poll/js/poll.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,19 @@ Poll.prototype.showPollResults = function(data) {
175175
var count_list = results[2];
176176
var div_id = results[3];
177177

178-
this.resultsDiv.html("<b>Results:</b><br><br>");
178+
$(this.resultsDiv).html("<b>Results:</b><br><br>");
179179

180180
var list = $(document.createElement("ol"));
181181
for(var i=0; i<opt_list.length; i++) {
182182
var count = count_list[i];
183183
var percent = (count / total) * 100;
184184
var text = Math.round(10*percent)/10 + "%"; // round percent to 10ths
185185

186-
var html = "<li value='"+opt_list[i]+"'><div class='progress'><div class='progress-bar progress-bar-success' style=width:'"+percent+"'%;><span class='poll-text'>"+text+"</span></div></div></li>";
186+
var html = "<li value='"+opt_list[i]+"'><div class='progress'><div class='progress-bar progress-bar-success' style=width:"+percent+"%;><span class='poll-text'>"+text+"</span></div></div></li>";
187187
var el = $(html);
188188
list.append(el);
189189
}
190-
this.resultsDiv.append(list);
190+
$(this.resultsDiv).append(list);
191191
};
192192

193193
Poll.prototype.disableOptions = function() {
@@ -202,7 +202,7 @@ Poll.prototype.checkPollStorage = function() {
202202
var data = {};
203203
data.div_id = this.divid;
204204
data.course = eBookConfig.course;
205-
jQuery.get(eBookConfig.ajaxURL+"getpollresults", data, this.showPollResults);
205+
jQuery.get(eBookConfig.ajaxURL+"getpollresults", data, this.showPollResults.bind(this));
206206
}
207207
};
208208

0 commit comments

Comments
 (0)