Module:Issue: Difference between revisions
From atwg
No edit summary |
m (1 revision imported) |
(No difference)
|
Revision as of 20:13, 16 January 2018
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="wikitext issue_table" style="border:1px solid #ccc;border-collapse:collapse;"\n'
result = result .. '! style="border:1px solid white;background-color:black;color:white;" | \n'
for k,v in ipairs( p.Taxonomy ) do
result = result .. '! colspan=' .. #v.values .. ' style="border:1px solid white;background-color:black;color:white;"| ' .. v.name .. '\n'
end
result = result .. '|-\n'
result = result .. '! style="border:1px solid white;background-color:black;color:white;" | Issue\n'
for k1,v1 in ipairs( p.Taxonomy ) do
for k2,v2 in ipairs( v1.values ) do
result = result .. '! style="border:1px solid white;background-color:black;color:white;" | ' ..
frame:expandTemplate{ title = 'Tag Link', args = { v2 } } .. '\n'
end
end
for k1,v1 in pairs( issues.results ) do
result = result .. '|-\n'
result = result .. '| style="border:1px solid #ccc;" | [[' .. 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="border:1px solid #ccc;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