Module:Election results: Difference between revisions
No edit summary |
mNo edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 229: | Line 229: | ||
end | end | ||
local ovalid = {valid[1], valid[2], valid[3]} | |||
seats = ((args['total_seats'] or '') == 'TOTAL' and seats) or args['total_seats'] or seats | seats = ((args['total_seats'] or '') == 'TOTAL' and seats) or args['total_seats'] or seats | ||
totseats = ((args['total_totseats'] or '') == 'TOTAL' and totseats) or args['total_totseats'] or totseats | totseats = ((args['total_totseats'] or '') == 'TOTAL' and totseats) or args['total_totseats'] or totseats | ||
| Line 237: | Line 237: | ||
st4t = ((args['total_st4t'] or '') == 'TOTAL' and st4t) or args['total_st4t'] or st4t | st4t = ((args['total_st4t'] or '') == 'TOTAL' and st4t) or args['total_st4t'] or st4t | ||
st5t = ((args['total_st5t'] or '') == 'TOTAL' and st5t) or args['total_st5t'] or st5t | st5t = ((args['total_st5t'] or '') == 'TOTAL' and st5t) or args['total_st5t'] or st5t | ||
if seats or totseats or st1t or st2t or st3t or st4t or st5t or args['total_sc'] or args['total_st1t'] or args['total_st2t'] or args['total_st3t'] or args['total_st4t'] or args['total_st5t'] or args['valid'] or ((rounds > 1) and args['valid2']) or ((rounds > 1) and args['valid3']) then | |||
-- Skip adding total row if no_totals is set to true | |||
if args.no_percentages ~= "true" and (seats or totseats or st1t or st2t or st3t or st4t or st5t or args['total_sc'] or args['total_st1t'] or args['total_st2t'] or args['total_st3t'] or args['total_st4t'] or args['total_st5t'] or args['valid'] or ((rounds > 1) and args['valid2']) or ((rounds > 1) and args['valid3'])) then | |||
max_rows = max_rows + 1 | max_rows = max_rows + 1 | ||
local i = max_rows | local i = max_rows | ||
| Line 265: | Line 267: | ||
ovalid[3] = tonumber(args['valid3']) or valid[3] | ovalid[3] = tonumber(args['valid3']) or valid[3] | ||
end | end | ||
-- build the table | -- build the table | ||
local root = mw.html.create(args['embed'] and '' or 'table') | local root = mw.html.create(args['embed'] and '' or 'table') | ||
| Line 418: | Line 419: | ||
:done() | :done() | ||
:tag('th') | :tag('th') | ||
:wikitext(args.secondround or ' | :wikitext(args.secondround or 'Final round') | ||
:attr('scope', 'col') | :attr('scope', 'col') | ||
:attr('colspan', 4) | :attr('colspan', 4) | ||
| Line 430: | Line 431: | ||
:done() | :done() | ||
:tag('th') | :tag('th') | ||
:wikitext(args.secondround or ' | :wikitext(args.secondround or 'Final round') | ||
:attr('scope', 'col') | :attr('scope', 'col') | ||
:attr('colspan', 3) | :attr('colspan', 3) | ||
| Line 476: | Line 477: | ||
:done() | :done() | ||
:tag('th') | :tag('th') | ||
:wikitext(args.secondround or ' | :wikitext(args.secondround or 'Final round') | ||
:attr('scope', 'col') | :attr('scope', 'col') | ||
:attr('colspan', 2) | :attr('colspan', 2) | ||