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', 'VODs' } VODLIST = { 'Vod', 'Vod2', 'Vod3', 'Vod4', 'Vod5', 'Vod6', 'Vod7' }

local i18n = { Vod = 'Vod', Vod2 = 'Vod2', Vod3 = 'Vod3', Vod4 = 'Vod4', Vod5 = 'Vod5', Vod6 = 'Vod6', Vod7 = 'Vod7', }

local h = {} local p = {}

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

function TS:getEntity1(args) return util_title.target(m_team.teamlinkname(args[1])) end

function TS:getEntity2(args) return util_title.target(m_team.teamlinkname(args[2])) 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', 'MS.Team2Score', 'MS.ShownName', 'MS.ExcludeH2H', 'MS.Vod', 'MS.Vod2', 'MS.Vod3', 'MS.Vod4', 'MS.Vod5', 'MS.Vod6', 'MS.Vod7' } end

function TS:getWhere(team1, team2, args) local tbl = { ('((TR1._pageName="%s" AND TR2._pageName="%s") OR (TR1._pageName="%s" AND TR2._pageName="%s"))'):format(			team1,			team2,			team2,			team1		), 'MS.Winner IS NOT NULL', 'MS.ExcludeH2H = "No"' }	return tbl end

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

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

function TS:markupTotalEntity2(entity) return m_team.rightmedium(entity) end

function TS:makeMatchVodList(row) local tbl = {} for _, v in ipairs(VODLIST) do		if row[v] then tbl[#tbl+1] = ('[%s %s]'):format(row[v], i18n[v]) end end return table.concat(tbl, ' &#8226; ') end

return p