Module:BrandSeries: Difference between revisions

Remove Browse column, add Unassigned row for models without series (via update-page on MediaWiki MCP Server)
Remove Unassigned row - handled by template italicized line instead (via update-page on MediaWiki MCP Server)
Line 57: Line 57:
end
end
end
end
-- Query count of models with NO series assigned
local unassignedQuery = string.format(
'{{#ask:[[Category:CRT models]][[Has brand::%s]][[Has series::!+]]|format=count}}',
brand
)
local unassignedResult = frame:preprocess(unassignedQuery)
local unassignedCount = tonumber(trim(unassignedResult)) or 0
-- Convert to sorted array
-- Convert to sorted array
Line 78: Line 70:
table.sort(rows, function(a, b) return a.series < b.series end)
table.sort(rows, function(a, b) return a.series < b.series end)
-- If no series found and no unassigned models, return nothing
-- If no series found, return nothing
if #rows == 0 and unassignedCount == 0 then
if #rows == 0 then
return ""
return ""
end
end
Line 93: Line 85:
table.insert(lines, '|-')
table.insert(lines, '|-')
table.insert(lines, '| ' .. seriesLink .. ' || ' .. tostring(row.count))
table.insert(lines, '| ' .. seriesLink .. ' || ' .. tostring(row.count))
end
-- Unassigned row (if any)
if unassignedCount > 0 then
table.insert(lines, '|-')
table.insert(lines, "| ''(Unassigned)'' || " .. tostring(unassignedCount))
end
end
MediaWiki Appliance - Powered by TurnKey Linux