mNo edit summary
mNo edit summary
Line 2: Line 2:
local cargo = mw.ext.cargo
local cargo = mw.ext.cargo


local x =  
local commendations =  
{
{
    { "", "", "Hero of the Federation", "", "" },
    { "M.I. Bronze Star", "M.I. Cross", "Medal of Valour", "Legion of Merit", "M.I. Silver Star" },
    { "Corporal", "Sergeant", "Commanding Officer", "Marauder", "Pathfinder" },
    { "MIPOD", "Medic", "Trooper", "Engineer", "Aviator" },
    { "Superior Command Commendation", "Distinguished Service Commendation", "Veterans Commendation", "Prisoner of War Commendation", "Emergency First Aid Commendation" },
    { "Professional Development Commendation", "Meritorious Service Commendation", "Good Conduct Commendation", "Humanitarian Aid Commendation", "M.I. Reconnaissance Commendation" },
    { "Combat Commendation", "PsyOps Accomplishment Commendation", "Medical Accomplishment Commendation", "Engineering Accomplishment Commendation", "Purple Heart" },
    { "", "", "Veteran's Ribbon", "", "" },
    { "Operation Big K Pin", "", "", "", "" }
}
}


local output = [[
local output = [[
<div class="tattoo">
<div class="%%1%%">
&nbsp;
&nbsp;
</div>
</div>
Line 39: Line 30:
     end
     end


    output = string.gsub("%%1%%", "tattoo-1")
     return output
     return output
end
end


return p
return p

Revision as of 23:31, 17 November 2022

Documentation for this module may be created at Module:Tattoo/doc

local p = {}
local cargo = mw.ext.cargo

local commendations = 
{
}

local output = [[
<div class="%%1%%">
&nbsp;
</div>
]]

function p.Main( frame )
    local t = {}
    local tables = 'Commendations'
    local fields = 'Commendation, COUNT(*)'

    local args = {
        groupBy = 'Commendation',
        where = 'Recipient = "' .. frame.args[1] .. '" AND Approved = true'
    }

    local results = cargo.query( tables, fields, args )
    local groups = {}
    
    for r = 1, #results do
        local r = results[r]
        groups[r.Commendation] = r["COUNT(*)"]
    end

    output = string.gsub("%%1%%", "tattoo-1")
    return output
end

return p


Categories: