Module:ScheduleHistoryH2H/Teams

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_html = require('Module:HtmlUtil') local util_time = require('Module:TimeUtil') local util_title = require("Module:TitleUtil") local util_vars = require('Module:VarsUtil') local m_team = require('Module:Team')

local TS = require('Module:ScheduleHistoryH2HAbstract'):extends

TS.COLUMNS = { 'Date', 'Event', 'Round', 'Team 1', 'Team 2', 'Score' }

local h = {} local p = {}

function p.main(frame) local args = util_args.merge return TS(args[1], args[2]):run(args) end

function TS:init(arg1, arg2) self:super('init', arg1, arg2) self.entityLiteral1 = self.entity1 self.entityLiteral2 = self.entity2 end

function TS:getEntity(arg) return util_title.target(m_team.teamlinkname(arg)) end

function TS:getTables return { 'MatchSchedule=MS', 'TeamRedirects=TR1', 'TeamRedirects=TR2', } end

function TS:getJoin return { 'MS.Team1=TR1.AllName', 'MS.Team2=TR2.AllName', } end

function TS:getFields return { 'MS.Team1', 'MS.Team2', 'TR1._pageName=Entity1', 'TR2._pageName=Entity2', 'MS.DateTime_UTC=UTC', 'MS.OverviewPage', 'MS.Winner', 'MS.Tab', 'MS.ShownRound', 'MS.Round', 'MS.Team1Score [number]', 'MS.Team2Score [number]', 'MS.ShownName' } end

function TS:getWhere(args) local tbl = { ('((TR1._pageName="%s" AND TR2._pageName="%s") OR (TR1._pageName="%s" AND TR2._pageName="%s"))'):format(			self.entity1,			self.entity2,			self.entity2,			self.entity1		), 'Winner IS NOT NULL' }	return tbl end

-- process function TS:getEntityMarkup(row, i) return m_team.rightmediumlinked(row['Team' .. i]) end

-- output function TS:markupTotalEntity1 return m_team.leftmedium(self.entity1) end

function TS:markupTotalEntity2 return m_team.rightmedium(self.entity2) end

return p