Content deleted Content added
+ |
+ |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 62:
local stop_flag = false
local i = 0
local has_votes = args['votes' .. i]
local has_votes2 = args['votes' .. i .. '_2']
local has_votes3 = args['votes' .. i .. '_3']
Line 98 ⟶ 99:
args['votes' .. i] = votesi
valid[1] = valid[1] + votesi
has_votes = true
end
if args['party' .. i] then
has_party = true
end
--[[Do something like this to reduce code duplication below
local has_votes = {}
for j = 2, 13 do
if args['votes' .. i .. "_" .. j] then
has_votes[j] = true
end
end]]--
if args['votes' .. i .. '_2'] then
has_votes2 = true
Line 218 ⟶ 228:
local ovalid = {valid[1], valid[2], valid[3], valid[4], valid[5], valid[6], valid[7], valid[8], valid[9], valid[10], valid[11], valid[12], valid[13]}
if has_votes or args['valid'] then
max_rows = max_rows + 1
local i = max_rows
table.insert(index, i)
args['row' .. i] = 'Total'▼
args['votes' .. i] = showtotal.votes and valid[1] or nil
args['votes' .. i .. '_2'] = showtotal.votes_2 and valid[2] or nil
Line 237 ⟶ 248:
args['colour' .. i] = 'inherit'
args['color' .. i] = 'inherit'
▲ args['row' .. i] = 'Total'
args['font-weight' .. i] = 'bold'
args['class' .. i] = 'sortbottom'
Line 323 ⟶ 333:
row
:tag('th')
:wikitext(args.firstround or 'First count')
:attr('colspan', 2)
--[[consider using a smaller function which accepts a text to handle this
local function create_row(row, text)
row
:tag('th')
:wikitext(text)
:attr('colspan', 2)
return row
end
]]
if has_votes2 then
row
:tag('th')
:wikitext(args.secondround or 'Second count')
:attr('colspan', 2)
end
Line 334 ⟶ 354:
row
:tag('th')
:wikitext(args.thirdround or 'Third count')
:attr('colspan', 2)
end
Line 340 ⟶ 360:
row
:tag('th')
:wikitext(args.fourthround or 'Fourth count')
:attr('colspan', 2)
end
Line 346 ⟶ 366:
row
:tag('th')
:wikitext(args.fifthround or 'Fifth count')
:attr('colspan', 2)
end
Line 352 ⟶ 372:
row
:tag('th')
:wikitext(args.sixthround or 'Sixth count')
:attr('colspan', 2)
end
Line 697 ⟶ 717:
:tag('td')
:attr('colspan', 3)
:wikitext(args['row' .. v])
end
if args['row' .. v] and not has_party then
row
:css('background-color', rcolor)
:tag('td')
:wikitext(args['row' .. v])
end
Line 717 ⟶ 743:
:wikitext(args['party' .. v])
end
if has_votes then
row:tag('td')
:css('text-align', 'right')
Line 723 ⟶ 750:
:css('text-align', 'right')
:wikitext(pct(args['votes' .. v], valid[1]))
end
if args['votes' .. v .. '_2'] then
row:tag('td')
|