Module:RFX report and Module:RFX report/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
update from /sandbox. Implements support for RRfAs |
Sohom Datta (talk | contribs) tt |
||
Line 63: | Line 63: | ||
local percentStr = mw.ustring.format( '%d', percent ) |
local percentStr = mw.ustring.format( '%d', percent ) |
||
if percent == 0 and supports == 0 and opposes == 0 and neutrals == 0 then |
if percent == 0 and supports == 0 and opposes == 0 and neutrals == 0 then |
||
percentStr = ' |
percentStr = 'NA' |
||
elseif percent == 100 and opposes ~= 0 then |
|||
percentStr = '>99' |
|||
end |
end |
||
Line 75: | Line 73: | ||
| class="rfx-report-number" | [[%s#Oppose|%d]] |
| class="rfx-report-number" | [[%s#Oppose|%d]] |
||
| class="rfx-report-number" | [[%s#Neutral|%d]] |
| class="rfx-report-number" | [[%s#Neutral|%d]] |
||
| class="rfx-report-number rfx-report-percent" style="background: #%s; |
| class="rfx-report-number rfx-report-percent" style="background: #%s;" | %s]==], |
||
page, supports, |
page, supports, |
||
page, opposes, |
page, opposes, |
||
Line 133: | Line 131: | ||
elseif rfxType == 'rfb' then |
elseif rfxType == 'rfb' then |
||
rfxCaps = 'RfB' |
rfxCaps = 'RfB' |
||
elseif rfxType == 'rrfa' then |
|||
rfxCaps = 'RRfA' |
|||
else |
else |
||
return nil |
return nil |
||
Line 152: | Line 148: | ||
local rfas = {} |
local rfas = {} |
||
local rfbs = {} |
local rfbs = {} |
||
local rrfas = {} |
|||
for i, rfxPage in ipairs( rfxes ) do |
for i, rfxPage in ipairs( rfxes ) do |
||
local rfxObject = rfx.new( rfxPage ) |
local rfxObject = rfx.new( rfxPage ) |
||
Line 160: | Line 155: | ||
elseif rfxObject.type == 'rfb' then |
elseif rfxObject.type == 'rfb' then |
||
table.insert( rfbs, rfxObject ) |
table.insert( rfbs, rfxObject ) |
||
elseif rfxObject.type == 'rrfa' then |
|||
table.insert( rrfas, rfxObject) |
|||
end |
end |
||
end |
end |
||
end |
end |
||
return rfas, rfbs |
return rfas, rfbs |
||
end |
end |
||
local function makeReportRows() |
local function makeReportRows() |
||
local rfas, rfbs |
local rfas, rfbs = getRfasRfbsSeparate() |
||
local ret = {} |
local ret = {} |
||
if #rfas |
if #rfas > 0 then |
||
table.insert( ret, makeHeading( 'rfa' ) ) |
table.insert( ret, makeHeading( 'rfa' ) ) |
||
for i, rfaObject in ipairs( rfas ) do |
for i, rfaObject in ipairs( rfas ) do |
||
table.insert( ret, makeRow( rfaObject ) ) |
table.insert( ret, makeRow( rfaObject ) ) |
||
end |
|||
for i, rrfaObject in ipairs( rrfas ) do |
|||
table.insert( ret, makeRow( rrfaObject ) ) |
|||
end |
end |
||
end |
end |
||
if #rfbs > 0 then |
if #rfbs > 0 then |
||
table.insert( ret, makeHeading( 'rfb' ) ) |
table.insert( ret, makeHeading( 'rfb' ) ) |
||
Line 232: | Line 221: | ||
function p.countRfas() |
function p.countRfas() |
||
local rfas, rfbs |
local rfas, rfbs = getRfasRfbsSeparate() |
||
return getTableLength(rfas) |
return getTableLength(rfas) |
||
end |
end |