Jump to content

Module:NPP backlog

Kufuma Wikipedia

This module retrieves the size of the backlog at new pages patrol for a given day. It uses the data compiled by User:MusikBot at Wikipedia:New pages patrol/Backlog chart/daily.

Number of articles in the backlog on date (YYYY-MM-DD format):

{{#invoke:NPP backlog|articles|date}}

Difference between two dates:

{{#invoke:NPP backlog|articles|date1|date2}}

Note that Wikipedia:New pages patrol/Backlog chart/daily is limited to the last c. 6 months.


local p = {};

local data = mw.loadJsonData("Wikipedia:New pages patrol/Backlog chart/daily")

local backlog = { }
for k,v in ipairs(data) do
	backlog[v["date"]] = v["value"]
end

function p._articles(day1, day2)
	if day2 == nil then
		return backlog[day1] or 0
	else
		if (backlog[day1] == nil or backlog[day2] == nil) then
			return 0
		else
			return backlog[day1] - backlog[day2]
		end
	end
end

function p.articles(frame)
	local templateArgs = frame.args
	local day1 = templateArgs[1] or os.date("%Y-%m-%d")
	local day2 = templateArgs[2] or nil
	return p._articles(day1, day2)
end

return p