މޮޑިއުލް:NUMBEROF/meta
މޮޑިއުލް ޑޮކިއުމަންޓޭޝަން[create]
You might want to create a documentation page for this Scribunto module. Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this module. |
local function makeData()
local statistics = mw.ext.data.get('Wikipedia statistics/meta.tab') -- https://commons.wikimedia.org/wiki/Data:Wikipedia_statistics/meta.tab
local map = {}
for i, v in ipairs(statistics.schema.fields) do
map[v.name] = i -- name is lowercase
end
local iProject = map.project
local iStatus = map.status
local nrActive = {}
local nrClosed = {}
for _, v in ipairs(statistics.data) do
local project = v[iProject]
if v[iStatus] == 'active' then
nrActive[project] = (nrActive[project] or 0) + 1
else
nrClosed[project] = (nrClosed[project] or 0) + 1
end
end
return {
nrActive = nrActive,
nrClosed = nrClosed,
}
end
return makeData()