Difference between revisions of "Module:Reports"
From cpt
No edit summary |
No edit summary |
||
Line 72: | Line 72: | ||
local result = mw.smw.getQueryResult( | local result = mw.smw.getQueryResult( | ||
'[[Project::Core Platform Team Workboards (Green)]][[Column::Done]]' .. | '[[Project::Core Platform Team Workboards (Green)]][[Column::Done]]' .. | ||
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' .. | |||
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' ) | |||
if result ~= nil then | |||
count = #result.results | |||
s = s .. sprintDates[index] .. ',' .. count .. '\n' | |||
end | |||
end | |||
return s | |||
end | |||
function p.clinicDutyTasksReport(frame) | |||
local sprintDates = mw.text.split(frame.args[1], ',') | |||
local column = frame.args[2] | |||
local points = {} | |||
s = '' | |||
for index = 2, #sprintDates do | |||
count = 0 | |||
local result = mw.smw.getQueryResult( | |||
'[[Project::Core Platform Team Workboards (Clinic Duty Team)]][[Column::' .. column .. ']]' .. | |||
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' .. | '[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' .. | ||
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' ) | '[[Column Entry Date::<' .. sprintDates[index] .. ']]' ) |
Revision as of 08:46, 2 March 2020
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 timestamp_start = os.time( start )
local now = os.time()
local s = ''
local created = 0
local closed = 0
while timestamp_start < now do
local timestamp_stop = timestamp_start + (step * 86400)
if timestamp_stop > now then
timestamp_stop = now
end
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
function p.greenDonePointsReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local points = {}
s = ''
for index = 2, #sprintDates do
sum = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Green)]][[Column::Done]]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' ..
'|?-Has subobject.Points' )
if result ~= nil then
for k,v in pairs( result.results ) do
if #v.printouts.Points > 0 then
sum = sum + v.printouts.Points[next(v.printouts.Points)]
end
end
s = s .. sprintDates[index] .. ',' .. sum .. '\n'
end
end
return s
end
function p.greenDoneTasksReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local points = {}
s = ''
for index = 2, #sprintDates do
count = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Green)]][[Column::Done]]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' )
if result ~= nil then
count = #result.results
s = s .. sprintDates[index] .. ',' .. count .. '\n'
end
end
return s
end
function p.clinicDutyTasksReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local column = frame.args[2]
local points = {}
s = ''
for index = 2, #sprintDates do
count = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Clinic Duty Team)]][[Column::' .. column .. ']]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' )
if result ~= nil then
count = #result.results
s = s .. sprintDates[index] .. ',' .. count .. '\n'
end
end
return s
end
function p.clinicDutyDoneTasksReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local points = {}
s = ''
for index = 2, #sprintDates do
count = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Clinic Duty Team)]][[Column::Done]]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' )
if result ~= nil then
count = #result.results
s = s .. sprintDates[index] .. ',' .. count .. '\n'
end
end
return s
end
function p.clinicDutyExternalCodeReviewCompletedTasksReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local points = {}
s = ''
for index = 2, #sprintDates do
count = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Clinic Duty Team)]][[Column::External Code Review Completed]]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' )
if result ~= nil then
count = #result.results
s = s .. sprintDates[index] .. ',' .. count .. '\n'
end
end
return s
end
function p.clinicDutyExternalCodeReviewInProgressTasksReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local points = {}
s = ''
for index = 2, #sprintDates do
count = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Clinic Duty Team)]][[Column::External Code Review In Progress]]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' )
if result ~= nil then
count = #result.results
s = s .. sprintDates[index] .. ',' .. count .. '\n'
end
end
return s
end
function p.clinicDutyExternalCodeReviewNeededTasksReport(frame)
local sprintDates = mw.text.split(frame.args[1], ',')
local points = {}
s = ''
for index = 2, #sprintDates do
count = 0
local result = mw.smw.getQueryResult(
'[[Project::Core Platform Team Workboards (Clinic Duty Team)]][[Column::External Code Review Needed]]' ..
'[[Column Entry Date::>>' .. sprintDates[index - 1] .. ']]' ..
'[[Column Entry Date::<' .. sprintDates[index] .. ']]' )
if result ~= nil then
count = #result.results
s = s .. sprintDates[index] .. ',' .. count .. '\n'
end
end
return s
end
return p