Module:BiologicalAgeBiomarkers: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 12: Line 12:


function p.createCrossTable(frame)
function p.createCrossTable(frame)
    for _, study in ipairs(studies) do
    local count = 0
for _ in pairs(study.biomarkers) do
count = count + 1
end
    study.count = count
end
     -- Start of the wiki table
     -- Start of the wiki table
     local wikitable = '{| class="wikitable sortable"\n'
     local wikitable = '{| class="wikitable sortable"\n'
 
     local sep = ''
     -- Column headers: Biomarker and System
    wikitable = wikitable .. '! colspan="2" | Sort !! '
    for _, study in pairs(studies) do
        wikitable = wikitable .. ' !! '
end
wikitable = wikitable .. '\n'


     for i, row in ipairs(rows) do
     for i, row in ipairs(rows) do
         wikitable = wikitable .. '|-\n'
         wikitable = wikitable .. sep
         wikitable = wikitable .. '! colspan="2" | ' .. row.name .. '\n'
        sep = '|-\n'
         wikitable = wikitable .. '! colspan="3" | ' .. row.name .. '\n'
         for _, study in ipairs(studies) do
         for _, study in ipairs(studies) do
             local cellValue = study[row.key] or ""
             local cellValue = study[row.key] or ""
wikitable = wikitable .. '! ' .. p.template(frame, "VerticalText", cellValue) .. '\n'
            if (row.rotate) then
cellValue = p.template(frame, "VerticalText", cellValue)
else
end
wikitable = wikitable .. '! ' .. cellValue .. '\n'
         end
         end
end
end