<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ARFX_table</id>
	<title>Module:RFX table - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ARFX_table"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:RFX_table&amp;action=history"/>
	<updated>2026-06-13T22:14:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:RFX_table&amp;diff=479069&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:RFX_table&amp;diff=479069&amp;oldid=prev"/>
		<updated>2021-07-16T05:32:47Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module is a replacement for the RfX report bot.&lt;br /&gt;
&lt;br /&gt;
local rfx = require( 'Module:Rfx' )&lt;br /&gt;
local colours = mw.loadData( 'Module:RFX report/colour' )&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function makeRow( rfxObject )&lt;br /&gt;
    if not ( type( rfxObject ) == 'table' and rfxObject.getTitleObject and rfxObject.getSupportUsers ) then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    local style = ''&lt;br /&gt;
    local styleInline = ''&lt;br /&gt;
    local status = rfxObject:getStatus()&lt;br /&gt;
    if status == 'pending closure' then&lt;br /&gt;
        style = ' style=&amp;quot;background: #f8cdc6;&amp;quot; |'&lt;br /&gt;
        styleInline = ' background: #f8cdc6;'&lt;br /&gt;
    end&lt;br /&gt;
    local page = rfxObject:getTitleObject().prefixedText&lt;br /&gt;
    local user = rfxObject.user or rfxObject:getTitleObject().subpageText&lt;br /&gt;
    local supports = rfxObject.supports&lt;br /&gt;
    local opposes = rfxObject.opposes&lt;br /&gt;
    local neutrals = rfxObject.neutrals&lt;br /&gt;
    local percent = rfxObject.percent&lt;br /&gt;
    local colour&lt;br /&gt;
    if percent then&lt;br /&gt;
        colour = colours[ rfxObject.type ][ percent ]&lt;br /&gt;
    end&lt;br /&gt;
    colour = colour or ''&lt;br /&gt;
    local votes&lt;br /&gt;
    if supports and opposes and neutrals and percent then&lt;br /&gt;
        votes = mw.ustring.format( [==[&lt;br /&gt;
        &lt;br /&gt;
| style=&amp;quot;text-align: right;%s&amp;quot; | [[%s#Support|%d]]&lt;br /&gt;
| style=&amp;quot;text-align: right;%s&amp;quot; | [[%s#Oppose|%d]]&lt;br /&gt;
| style=&amp;quot;text-align: right;%s&amp;quot; | [[%s#Neutral|%d]]&lt;br /&gt;
| style=&amp;quot;text-align: right; background: #%s;&amp;quot; | %d]==],&lt;br /&gt;
            styleInline, page, supports,&lt;br /&gt;
            styleInline, page, opposes,&lt;br /&gt;
            styleInline, page, neutrals,&lt;br /&gt;
            colour, percent&lt;br /&gt;
        )&lt;br /&gt;
    else&lt;br /&gt;
        votes = '\n| colspan=&amp;quot;4&amp;quot; style=&amp;quot;background: #f8cdc6;&amp;quot; | Error parsing votes'&lt;br /&gt;
    end&lt;br /&gt;
    if status then&lt;br /&gt;
        status = mw.language.getContentLanguage():ucfirst( status )&lt;br /&gt;
        if status == 'Pending closure' then&lt;br /&gt;
            status = 'Pending closure...'&lt;br /&gt;
        end&lt;br /&gt;
        status = mw.ustring.format( '\n| %s %s', style, status )&lt;br /&gt;
    else&lt;br /&gt;
        status = '\n| style=&amp;quot;background: #f8cdc6;&amp;quot; | Error getting status'&lt;br /&gt;
    end &lt;br /&gt;
    local endTime = rfxObject.endTime&lt;br /&gt;
    local secondsLeft = rfxObject:getSecondsLeft()&lt;br /&gt;
    local timeLeft = rfxObject:getTimeLeft()&lt;br /&gt;
    local time&lt;br /&gt;
    if endTime and timeLeft then&lt;br /&gt;
        time = mw.ustring.format( '\n| %s %s\n| %s %s', style, endTime, style, timeLeft )&lt;br /&gt;
    else&lt;br /&gt;
        time = '\n| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background: #f8cdc6;&amp;quot; | Error parsing end time'&lt;br /&gt;
    end&lt;br /&gt;
    local dupes = rfxObject:dupesExist()&lt;br /&gt;
    if dupes then&lt;br /&gt;
        dupes = &amp;quot;'''yes'''&amp;quot;&lt;br /&gt;
    elseif dupes == false then&lt;br /&gt;
        dupes = 'no'&lt;br /&gt;
    else&lt;br /&gt;
        dupes = '--'&lt;br /&gt;
    end&lt;br /&gt;
    local report = rfxObject:getReport()&lt;br /&gt;
    if report then&lt;br /&gt;
        report = mw.ustring.format( '\n|%s [%s report]', style, tostring( report ) )&lt;br /&gt;
    else&lt;br /&gt;
        report = '\n| style=&amp;quot;background: #f8cdc6;&amp;quot; | Report not found'&lt;br /&gt;
    end&lt;br /&gt;
    return mw.ustring.format(&lt;br /&gt;
        '\n|-\n|%s [[%s|%s]]%s%s%s\n| style=&amp;quot;text-align: center;%s&amp;quot; | %s%s',&lt;br /&gt;
        style, page, user, votes, status, time, styleInline, dupes, report&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeHeading( rfxType )&lt;br /&gt;
    if type( rfxType ) ~= 'string' then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    return mw.ustring.format(&lt;br /&gt;
        '\n|-\n! %s candidate !! S !! O !! N !! S%% !! Status !! Ending (UTC) !! Time left !! Dupes? !! Report',&lt;br /&gt;
        rfxType&lt;br /&gt;
    )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getRfxes( args )&lt;br /&gt;
    if type( args ) ~= 'table' then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    local nums, ret = {}, {}&lt;br /&gt;
    for k, v in pairs( args ) do&lt;br /&gt;
        if type( k ) == 'number' and k &amp;gt;= 1 and math.floor( k ) == k and k ~= math.huge then&lt;br /&gt;
            table.insert( nums, k )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    table.sort( nums )&lt;br /&gt;
    for i, v in ipairs( nums ) do&lt;br /&gt;
        ret[ i ] = args[ v ]&lt;br /&gt;
    end&lt;br /&gt;
    return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeReportRows( args )&lt;br /&gt;
    local rfxes = getRfxes( args )&lt;br /&gt;
    if not rfxes then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    -- Get RfX objects and separate RfAs and RfBs.&lt;br /&gt;
    local rfas = {}&lt;br /&gt;
    local rfbs = {}&lt;br /&gt;
    for i, rfxPage in ipairs( rfxes ) do&lt;br /&gt;
        local rfxObject = rfx.new( rfxPage )&lt;br /&gt;
        if rfxObject then&lt;br /&gt;
            if rfxObject.type == 'rfa' then&lt;br /&gt;
                table.insert( rfas, rfxObject )&lt;br /&gt;
            elseif rfxObject.type == 'rfb' then&lt;br /&gt;
                table.insert( rfbs, rfxObject )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    local ret = {}&lt;br /&gt;
    if #rfas &amp;gt; 0 then&lt;br /&gt;
        table.insert( ret, makeHeading( 'RfA' ) )&lt;br /&gt;
        for i, rfaObject in ipairs( rfas ) do&lt;br /&gt;
            table.insert( ret, makeRow( rfaObject ) )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if #rfbs &amp;gt; 0 then&lt;br /&gt;
        table.insert( ret, makeHeading( 'RfB' ) )&lt;br /&gt;
        for i, rfbObject in ipairs( rfbs ) do&lt;br /&gt;
            table.insert( ret, makeRow( rfbObject ) )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return table.concat( ret )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeReport( args )&lt;br /&gt;
    local purgeLink = mw.title.getCurrentTitle():fullUrl( 'action=purge' )&lt;br /&gt;
    local header = mw.ustring.format(&lt;br /&gt;
        '\n|-\n! colspan=&amp;quot;10&amp;quot; style=&amp;quot;text-align: center;&amp;quot; | Requests for [[Wikipedia:Requests for adminship|adminship]] and [[Wikipedia:Requests for bureaucratship|bureaucratship]]&amp;lt;span class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;float: right;&amp;quot;&amp;gt;&amp;lt;small&amp;gt;[%s update]&amp;lt;/small&amp;gt;&amp;lt;/span&amp;gt;',&lt;br /&gt;
        purgeLink&lt;br /&gt;
    )&lt;br /&gt;
    local rows = makeReportRows( args ) or ''&lt;br /&gt;
    if rows == '' then&lt;br /&gt;
        rows = '\n|-\n| colspan=&amp;quot;10&amp;quot; | No current discussions. &amp;lt;small&amp;gt;Recent RfAs: ([[Wikipedia:Successful requests for adminship|successful]], [[Wikipedia:Unsuccessful adminship candidacies (Chronological)|unsuccessful]]) Recent RfBs: ([[Wikipedia:Successful bureaucratship candidacies|successful]], [[Wikipedia:Unsuccessful bureaucratship candidacies|unsuccessful]])&amp;lt;/small&amp;gt;'&lt;br /&gt;
    end&lt;br /&gt;
    local style = args.style&lt;br /&gt;
    if not style then&lt;br /&gt;
        local float = args.float or args.align or 'right'&lt;br /&gt;
        local clear = args.clear or 'left'&lt;br /&gt;
        style = mw.ustring.format(&lt;br /&gt;
            'style=&amp;quot;white-space:wrap; clear: %s; margin-top: 0em; margin-bottom: .5em; float: %s; padding: .5em 0em 0em 1.4em; background: #ffffff; border-collapse: collapse; border-spacing: 0;&amp;quot;',&lt;br /&gt;
            clear, float&lt;br /&gt;
        )&lt;br /&gt;
    end&lt;br /&gt;
    return mw.ustring.format( '\n{| class=&amp;quot;wikitable&amp;quot; %s%s%s\n|-\n|}', style, header, rows )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
    -- If called via #invoke, use the args passed into the invoking&lt;br /&gt;
    -- template, or the args passed to #invoke if any exist. Otherwise&lt;br /&gt;
    -- assume args are being passed directly in from the debug console&lt;br /&gt;
    -- or from another Lua module.&lt;br /&gt;
    local origArgs&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        origArgs = frame:getParent().args&lt;br /&gt;
        for k, v in pairs( frame.args ) do&lt;br /&gt;
            origArgs = frame.args&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        origArgs = frame&lt;br /&gt;
    end&lt;br /&gt;
    -- Trim whitespace and remove blank arguments.&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs( origArgs ) do&lt;br /&gt;
        v = mw.text.trim( v )&lt;br /&gt;
        if v ~= '' then&lt;br /&gt;
            args[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return makeReport( args )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>