Модуль:Статистика: различия между версиями
Перейти к навигации
Перейти к поиску
StasR (обсуждение | вклад) (Новая страница: «local p = {} local tools = require( 'Module:Tools' ) function p.StatD( frame ) --[[ local docs = frame:callParserFunction{ name = '#cargo_query', args = { '',…») |
StasR (обсуждение | вклад) Нет описания правки |
||
Строка 1: | Строка 1: | ||
local p = {} | local p = {} | ||
local tools = require( 'Module:Tools' ) | local tools = require( 'Module:Tools' ) | ||
local cq = mw.ext.cargo.query | |||
function p.StatD( frame ) | function p.StatD( frame ) | ||
--[[ | --[[ | ||
local docs = frame:callParserFunction{ name = '#cargo_query', args = { '', | local docs = frame:callParserFunction{ name = '#cargo_query', args = { '', | ||
tables = 'docs', | tables = 'docs', | ||
Строка 13: | Строка 14: | ||
return mw.ext.cargo.get()[1].docs | return mw.ext.cargo.get()[1].docs | ||
--]] | --]] | ||
return | return cq( 'docs', 'COUNT(_pageID)', {} )[1]['COUNT(_pageID)'] | ||
end | end | ||
function p.StatP( frame ) | function p.StatP( frame ) | ||
--[[ | --[[ | ||
local persons = frame:callParserFunction{ name = '#cargo_query', args = { '', | local persons = frame:callParserFunction{ name = '#cargo_query', args = { '', | ||
tables = 'persons', | tables = 'persons', | ||
Строка 27: | Строка 28: | ||
return mw.ext.cargo.get()[1].persons | return mw.ext.cargo.get()[1].persons | ||
--]] | --]] | ||
return | return cq( 'persons', 'COUNT(_pageID)', {} )[1]['COUNT(_pageID)'] | ||
end | end | ||
return p | return p |
Текущая версия от 21:03, 27 января 2018
Для документации этого модуля может быть создана страница Модуль:Статистика/doc
local p = {}
local tools = require( 'Module:Tools' )
local cq = mw.ext.cargo.query
function p.StatD( frame )
--[[
local docs = frame:callParserFunction{ name = '#cargo_query', args = { '',
tables = 'docs',
fields = 'COUNT(_pageID) = docs',
-- limit = 10000,
format = 'native',
default = '',
} }
return mw.ext.cargo.get()[1].docs
--]]
return cq( 'docs', 'COUNT(_pageID)', {} )[1]['COUNT(_pageID)']
end
function p.StatP( frame )
--[[
local persons = frame:callParserFunction{ name = '#cargo_query', args = { '',
tables = 'persons',
fields = 'COUNT(_pageID) = persons',
-- limit = 10000,
format = 'native',
default = '',
} }
return mw.ext.cargo.get()[1].persons
--]]
return cq( 'persons', 'COUNT(_pageID)', {} )[1]['COUNT(_pageID)']
end
return p