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

To edit the documentation or categories for this module, click here.


local util_cargo = require('Module:CargoUtil')
local util_form = require('Module:FormUtil')
local util_esports = require('Module:EsportsUtil')
local util_table = require("Module:TableUtil")
local util_text = require("Module:TextUtil")
local util_vars = require('Module:VarsUtil')
local m_team = require('Module:Team')

local LCS = require('Module:LuaClassSystem')

local p = LCS.class.abstract()

local FIELDS = {
	'PB.Team1Role1',
	'PB.Team1Role2',
	'PB.Team1Role3',
	'PB.Team1Role4',
	'PB.Team1Role5',
	'PB.Team2Role1',
	'PB.Team2Role2',
	'PB.Team2Role3',
	'PB.Team2Role4',
	'PB.Team2Role5',
	'PB.Team1Ban1',
	'PB.Team1Ban2',
	'PB.Team1Ban3',
	'PB.Team1Ban4',
	'PB.Team1Ban5',
	'PB.Team1Pick1',
	'PB.Team1Pick2',
	'PB.Team1Pick3',
	'PB.Team1Pick4',
	'PB.Team1Pick5',
	'PB.Team2Ban1',
	'PB.Team2Ban2',
	'PB.Team2Ban3',
	'PB.Team2Ban4',
	'PB.Team2Ban5',
	'PB.Team2Pick1',
	'PB.Team2Pick2',
	'PB.Team2Pick3',
	'PB.Team2Pick4',
	'PB.Team2Pick5',
	'PB.Team1',
	'PB.Team2',
	'PB.Winner[number]',
	'PB.Team1Score',
	'PB.Team2Score',
	'PB.OverviewPage',
	'PB.Tab',
	'PB._pageName',
	'MS.Patch',
	'T.Region [region]',
	'T.Name=Tournament',
	'SG._pageName=ScoreboardPage',
	'SG.VOD',
	'SG.MatchHistory',
}

function p:init(args, page)
	self.fields = FIELDS
	self.args = args
	self.page = page
end

function p:makeQuery()
	return {
		tables = { 'PicksAndBansS7=PB', 'MatchSchedule=MS', 'Tournaments=T', 'ScoreboardGames=SG',  },
		join = {
			'PB.MatchId=MS.MatchId',
			'PB.OverviewPage=T.OverviewPage',
			'PB.GameId=SG.GameId',
		},
		fields = self.fields,
		where = self:getWhere(),
		orderBy = 'PB.N_Page DESC, PB.N_GameInPage DESC',
	}
end

function p:getWhere()
	local tbl = {
		'PB.Winner IS NOT NULL',
	}
	return tbl
end

-- output
function p:queryEntityDisplayName()
	if self.entityName then return self.entityName end
	local query = {
		tables = 'Tournaments',
		fields = 'Name',
		where = ('OverviewPage="%s"'):format(self.page)
	}
	self.entityName = util_cargo.getOneResult(query)
	return self.entityName
end

function p:queryEntityMarkup()
	return util_text.intLinkOrText(self:queryEntityDisplayName())
end

return p
Advertisement