Module:TestMatchList

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_esports = require('Module:EsportsUtil') local util_footnote = require('Module:FootnoteUtil') local util_game = require('Module:GameUtil') local util_map = require('Module:MapUtil') local util_html = require('Module:HtmlUtil') local util_matches = require('Module:MatchesUtil') local util_table = require('Module:TableUtil') local util_text = require('Module:TextUtil') local util_time = require('Module:TimeUtil') local util_toggle = require('Module:ToggleUtil') local util_vars = require('Module:VarsUtil') local m_team = require('Module:Team') local i18n = require('Module:i18nUtil') local Phase = require('Module:PhaseClass')

local lang = mw.getLanguage('en')

local ML = require('Module:MatchListAbstract'):extends

local useColumnsLayout = false;

local h = {} local p = {}

function ML:makeMatchFields(args) local fields = self:super('makeMatchFields', args) fields[#fields+1] = 'MS.Team1Rounds' fields[#fields+1] = 'MS.Team2Rounds' return fields end

function ML:printScore(tr, row, suppresstoggle) if useColumnsLayout then h.printRound(self:printOneScore(tr, row, 1, true), row, 1, suppresstoggle) self:super('printScore', tr, row, suppresstoggle) h.printRound(self:printOneScore(tr, row, 2, true), row, 2, suppresstoggle) else self:super('printScore', tr, row, suppresstoggle) end return end

function ML:printOneScore(tr, row, n, isRound) local td = tr:tag('td'):wikitext(self:getOneScore(row, n, isRound)) :addClass('matchlist-score') util_esports.addTeamHighlighter(td, row[('Team%sFinal'):format(n)]) return td end

function ML:getOneScore(row, n, isRound) if isRound then return row[('Team%sRounds'):format(n)] end return row[('Team%sScore'):format(n)] end

function ML:getAndRunMatchQuery(page, args) local outergroup = args.outergroup or 'Tab' local innergroup = args.innergroup or 'Date' local matchResult = util_cargo.queryAndCast(self:makeMatchQuery(page, args)) for _, data in ipairs(matchResult) do		if data.BestOf > 1 then h.setColumnsDefaults break end end return util_cargo.groupResultOrdered(matchResult, outergroup) end

function p.main(frame) local args = util_args.merge return ML:init(args) end

function h.setColumnsDefaults ML.COLSPAN = 6 useColumnsLayout = true ML.WIDTHS = { 110, 25, 25, 25, 25, 110 } end

function h.printRound(td, row, index, suppresstoggle) if row.Winner == index then td:addClass('matchlist-winner-score') elseif row.Winner == 0 then td:addClass('matchlist-tied-score') end if not suppresstoggle then util_toggle.oflCellClasses(td, ML.RS_TOGGLES, 'res') end end

return p