Author: humbedooh
Date: Sat Mar 21 00:14:23 2015
New Revision: 1668181
URL: http://svn.apache.org/r1668181
Log:
make statements actually show up
Modified:
steve/trunk/pytest/www/htdocs/js/steve_stv.js
Modified: steve/trunk/pytest/www/htdocs/js/steve_stv.js
URL:
http://svn.apache.org/viewvc/steve/trunk/pytest/www/htdocs/js/steve_stv.js?rev=1668181&r1=1668180&r2=1668181&view=diff
==============================================================================
--- steve/trunk/pytest/www/htdocs/js/steve_stv.js (original)
+++ steve/trunk/pytest/www/htdocs/js/steve_stv.js Sat Mar 21 00:14:23 2015
@@ -507,12 +507,13 @@ function loadIssue(election, issue, uid,
}
function displayIssueSTV(code, response, state) {
+ chars =
['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
// Corresponding STV letters, in same order as nominees
election_data = response
if (code != 200) {
document.getElementById('preloaderWrapper').innerHTML = "<h1>Could not
load issue:</h1><h2>" + response.message + "</h2>";
} else {
candidates = []
- statements = []
+ statements = {}
var m = response.issue.type.match(/(\d+)/);
if (m) {
seats = parseInt(m[1])
@@ -520,11 +521,10 @@ function displayIssueSTV(code, response,
for (c in response.issue.candidates) {
var candidate = response.issue.candidates[c];
candidates.push(candidate.name);
- statements.push(candidate.statement);
+ statements[chars[c]] = candidate.statement;
}
document.getElementById('cnum').innerHTML = candidates.length
- document.getElementById('snum').innerHTML = seats
- chars =
['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
// Corresponding STV letters, in same order as nominees
+ document.getElementById('snum').innerHTML = seats
while (chars.length > candidates.length) chars.splice(-1,1)
for (i in candidates) candidates_copy.push(candidates[i])