Module:Issue
From atwg
Documentation for this module may be created at Module:Issue/doc
local p = {}
p.Taxonomy = {
{
name = "High Level",
property = "High Level Property",
values = {
"Product Strategy",
"Platform Strategy",
"Culture",
"Process",
"Department Alignment"
}
},
{
name = "Technology",
property = "Technology Property",
values = {
"APIs",
"SOA",
"MediaWiki",
"Caching / Storage",
"Performance / Scaling",
"Build / Dev / Deploy",
"Analytics / A/B testing",
"(Isomorphic) JS"
}
},
{
name = "Customers",
property = "Customer Property",
values = {
"3rd Party Installs",
"3rd Party Clients",
"Operational Burden",
"Maintenance Burden",
"Development Burden"
}
},
{
name = "Time",
property = "Time Property",
values = {
"3-12 months",
"2-5 years"
}
},
{
name = "Symptom or Cause",
property = "Symptom or Cause",
values = {
"Is Symptom",
"Is Cause"
}
}
}
function p.displayMatrix(frame)
local query = '[[Category:Issues]]'
if frame.args['tag'] ~= nil then
query = query .. '[[Tag::' .. frame.args['tag'] .. ']]'
end
query = query .. "|?Description"
for k,v in ipairs( p.Taxonomy ) do
query = query .. '|?' .. v.property
end
query = query .. "|limit=1000";
local issues = mw.smw.getQueryResult( query )
if issues == nil or #issues.results == 0 then
return "no issues found"
end
result = #issues.results .. ' issues.\n\n'
result = result .. '{| class="wikitable issue_table sortable"\n'
result = result .. '! rowspan="2" | Issue\n'
for k,v in ipairs( p.Taxonomy ) do
result = result .. '! colspan=' .. #v.values .. ' | ' .. v.name .. '\n'
end
result = result .. '|-\n'
for k1,v1 in ipairs( p.Taxonomy ) do
for k2,v2 in ipairs( v1.values ) do
result = result .. '! ' ..
frame:expandTemplate{ title = 'Tag Link', args = { v2 } } .. '\n'
end
end
result = result .. '|-\n!!<br/>'
for k1,v1 in ipairs( p.Taxonomy ) do
for k2,v2 in ipairs( v1.values ) do
result = result .. '!!'
end
end
result = result .. '\n'
for k1,v1 in pairs( issues.results ) do
result = result .. '|-\n'
result = result .. '| [[' .. v1.fulltext .. '|' .. v1.printouts['Description'][1] .. ']]\n'
for k2,v2 in ipairs( p.Taxonomy ) do
local query_values = v1.printouts[v2.property]
for k3,v3 in ipairs( v2.values ) do
result = result .. '| style="text-align:center;min-width:60px;" |'
for k4,v4 in pairs(query_values) do
if v3 == v4 then
result = result .. 'X'
end
end
result = result .. '\n'
end
end
end
result = result .. '|}'
return result
end
return p