Difference between revisions of "Module:Reports"
From cpt
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
local timestamp_stop = timestamp_start + (step * 86400) | local timestamp_stop = timestamp_start + (step * 86400) | ||
local result = mw.smw.getQueryResult( | local result = mw.smw.getQueryResult( | ||
'[[Category:Phabricator Tasks]][[Has subobject.Project:: | '[[Category:Phabricator Tasks]][[Has subobject.Project::~Core Platform Team Workboards*]]' .. | ||
'[[Task Created Timestamp::>' .. timestamp_start .. ']]' .. | '[[Task Created Timestamp::>' .. timestamp_start .. ']]' .. | ||
'[[Task Created Timestamp::<<' .. timestamp_stop .. ']]' .. | '[[Task Created Timestamp::<<' .. timestamp_stop .. ']]' .. | ||
Line 24: | Line 24: | ||
end | end | ||
result = mw.smw.getQueryResult( | result = mw.smw.getQueryResult( | ||
'[[Category:Phabricator Tasks]][[Has subobject.Project:: | '[[Category:Phabricator Tasks]][[Has subobject.Project::~Core Platform Team Workboards*]]' .. | ||
'[[Task Closed Timestamp::>' .. timestamp_start .. ']]' .. | '[[Task Closed Timestamp::>' .. timestamp_start .. ']]' .. | ||
'[[Task Closed Timestamp::<<' .. timestamp_stop .. ']]' .. | '[[Task Closed Timestamp::<<' .. timestamp_stop .. ']]' .. |
Revision as of 23:42, 2 December 2019
Documentation for this module may be created at Module:Reports/doc
local p = {}
function p.taskCreationClosureReport(frame)
local start = {
year = frame.args[1],
month = frame.args[2],
day = frame.args[3]
}
local step = frame.args[4]
local count = frame.args[5]
local timestamp_start = os.time( start )
local s = ''
local created = 0
local closed = 0
for index = 1, count do
local timestamp_stop = timestamp_start + (step * 86400)
local result = mw.smw.getQueryResult(
'[[Category:Phabricator Tasks]][[Has subobject.Project::~Core Platform Team Workboards*]]' ..
'[[Task Created Timestamp::>' .. timestamp_start .. ']]' ..
'[[Task Created Timestamp::<<' .. timestamp_stop .. ']]' ..
'|limit=3000' )
if result ~= nil then
created = created + #result.results
end
result = mw.smw.getQueryResult(
'[[Category:Phabricator Tasks]][[Has subobject.Project::~Core Platform Team Workboards*]]' ..
'[[Task Closed Timestamp::>' .. timestamp_start .. ']]' ..
'[[Task Closed Timestamp::<<' .. timestamp_stop .. ']]' ..
'|limit=3000' )
if result ~= nil then
closed = closed + #result.results
end
s = s .. 'Created ;' .. os.date('%Y-%m-%d', timestamp_stop) .. ';' .. created .. '\n'
s = s .. 'Closed ;' .. os.date('%Y-%m-%d', timestamp_stop) .. ';' .. closed .. '\n'
timestamp_start = timestamp_stop
end
return s
end
return p