Leaguepedia | League of Legends Esports Wiki
Advertisement
Leaguepedia | League of Legends Esports Wiki

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

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 Team = require('Module:TeamClass')

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:name()
	self.entityLiteral2 = self.entity2:name()
end

function TS:getEntity(arg)
	return Team(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 [team]',
		'MS.Team2 [team]',
		'TR1._pageName=Entity1',
		'TR2._pageName=Entity2',
		'MS.DateTime_UTC=UTC',
		'MS.OverviewPage',
		'MS.Winner',
		'MS.Tab',
		'MS.ShownRound',
		'MS.Round',
		'MS.MatchId',
		'MS.Team1Score [number]',
		'MS.Team2Score [number]',
		'MS.ShownName',
		'MS._pageName=MSPage',
	}
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:get(),
			self.entity2:get(),
			self.entity2:get(),
			self.entity1:get()
		),
		'Winner IS NOT NULL'
	}
	return tbl
end

-- process
function TS:getEntityMarkup(row, i)
	return row['Team' .. i]:flairlink{len='medium'}
end

-- output
function TS:markupTotalEntity1()
	return self.entity1:flair{len='medium'}
end

function TS:markupTotalEntity2()
	return self.entity2:flair{len='medium'}
end

return p
Advertisement