Module:MjolnirsStrikeTable

local cargo = mw.ext.cargo local Datetime = require 'Module:DatetimeUtil'

local main = function (_, frame) local events = cargo.query('MjolnirsStrike', '_pageName=pgname,Leader=leader,AskrLV=al,StrikeLV=sl,StartTime=st,EndTime=et,CONCAT(AskrScore > StrikeScore)=result,BonusStructure=bs', {		orderBy = "StartTime",		groupBy = "_pageName",		limit = 5000,	})

local tbl = mw.html.create("table"):addClass("wikitable"):addClass("sortable"):css("text-align", "center") local row = tbl:tag("tr") row:tag("th"):wikitext("Event") row:tag("th"):wikitext("Strike leader") row:tag("th"):wikitext("Askr LV.") row:tag("th"):wikitext("Strike LV.") row:tag("th"):wikitext("Bonus Structure") row:tag("th"):wikitext("Event Dates") row:tag("th"):wikitext("Winner")

for _, event in ipairs(events) do		row = tbl:tag("tr") row:tag("td"):wikitext(frame:expandTemplate {title = "Banner Event", args = {bannerType = "Mjölnir's Strike", fontSize = 4, link = event.pgname}}, (' %s'):format(event.pgname)) row:tag("td"):wikitext(frame:expandTemplate {title = 'UnitText', args = {event.leader}}) row:tag("td"):wikitext(event.al) row:tag("td"):wikitext(event.sl) row:tag("td"):wikitext(frame:expandTemplate {title = 'StructureText', args = {event.bs}}) row:tag("td"):wikitext(Datetime.ht_range(event.st, event.et)) row:tag("td"):wikitext(event.result == '1' and 'Askr' or event.result == '0' and 'Thórr' or '') end

return tbl end

return require 'Module:MakeMWModule'.makeMWModule {main = main}