Module:Incorrect Tags
From cpt
Documentation for this module may be created at Module:Incorrect Tags/doc
local p = {}
function p.workboardsNoInitiative(frame)
local s = ''
local result1 = mw.smw.getQueryResult(
'[[Category:Phabricator Tasks]][[Status::open||stalled]][[CPT Column::!~Clinic Duty Team*]][[CPT Column::!~External Code Reviews*]]' ..
'|?CPT Initiative|?CPT Column|link=none|limit=1000' )
if result1 ~= nil then
local index = 0
for k1,v1 in pairs( result1.results ) do
local initiative = v1.printouts['CPT Initiative'][1]
if initiative == nil then
local column = v1.printouts['CPT Column'][1]
if column ~= nil then
index = index + 1
s = s .. '|-\n'
s = s .. '|[[' .. v1.fulltext .. ']]\n'
s = s .. '|' .. column .. '\n'
s = s .. '|\n'
local result2 = mw.smw.getQueryResult(
'[[-Has subobject::' .. v1.fulltext .. ']]' ..
'|?Project|?Column')
if result2 ~= nil then
for k2,v2 in pairs( result2.results ) do
local project = v2.printouts['Project'][1]
local column = v2.printouts['Column'][1]
if project ~= nil then
s = s .. '*' .. project
if column ~= nil then
s = s .. ' (' .. column .. ')'
end
s = s .. '\n'
end
end
end
end
end
end
if index > 0 then
h = '\n'
h = h .. '{| class="wikitable sortable"' .. '\n'
h = h .. '! Task' .. '\n'
h = h .. '! Workboards Column' .. '\n'
h = h .. '! class="unsortable" | Tags' .. '\n'
s = h .. s .. '|}'
end
s = '\'\'' .. index .. ' Tasks.\n' .. s
end
return s
end
function p.misplacedEpics(frame)
local s = ''
local result1 = mw.smw.getQueryResult(
'[[Category:Phabricator Tasks]][[Status::open||stalled]][[Has subobject.Project::Epic]][[CPT Column::+]] OR [[Category:Phabricator Tasks]][[Status::open||stalled]][[Has subobject.Project::Epic]][[CPT Initiative::+]]' ..
'|?CPT Initiative|?CPT Column|link=none|limit=1000' )
if result1 ~= nil then
local index = 0
for k1,v1 in pairs( result1.results ) do
local initiative = v1.printouts['CPT Initiative'][1]
if initiative == nil then
initiative = ''
end
local column = v1.printouts['CPT Column'][1]
if column == nil then
column = ''
end
local tags = ''
local result2 = mw.smw.getQueryResult(
'[[-Has subobject::' .. v1.fulltext .. ']][[Project::+]]' ..
'|?Project|?Column')
if result2 ~= nil then
local epic = false
for k2,v2 in pairs( result2.results ) do
local project = v2.printouts['Project'][1]
local column = v2.printouts['Column'][1]
if project == 'Platform Team Workboards (Epics)' then
epic = true
end
tags = tags .. '*' .. project
if column ~= nil then
tags = tags .. ' (' .. column .. ')'
end
tags = tags .. '\n'
end
if not epic then
index = index + 1
s = s .. '|-\n'
s = s .. '|[[' .. v1.fulltext .. ']]\n'
s = s .. '|' .. initiative .. '\n'
s = s .. '|' .. column .. '\n'
s = s .. '|\n'
s = s .. tags .. '\n'
end
end
end
if index > 0 then
h = '\n'
h = h .. '{| class="wikitable sortable"' .. '\n'
h = h .. '! Task' .. '\n'
h = h .. '! Initiative' .. '\n'
h = h .. '! Workboards Column' .. '\n'
h = h .. '! class="unsortable" | Tags' .. '\n'
s = h .. s .. '|}'
end
s = '\'\'' .. index .. ' Tasks.\n' .. s
end
return s
end
return p