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

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

local util_args = require('Module:ArgsUtil')
local util_cargo = require("Module:CargoUtil")
local util_esports = require("Module:EsportsUtil")
local util_html = require("Module:HtmlUtil")
local util_map = require('Module:MapUtil')
local util_table = require("Module:TableUtil")
local util_text = require("Module:TextUtil")
local util_vars = require("Module:VarsUtil")
local i18n = require("Module:I18nUtil")
local TeamRoster = require('Module:TeamRoster')._main
local Pool = require('Module:TournamentRosterPool')
local lang = mw.getLanguage('en')
local h = {}
local p = {}
function p.main(frame)
	local args = util_args.merge()
	local page = args.page or util_esports.getOverviewPage()
	local teams = h.getTeamsData(page, args)
	util_map.rowsInPlace(teams, h.formatTeamArgs)
	local nodes = util_map.inPlace(teams, TeamRoster)
	return h.makeOutput(nodes)
end

function h.getTeamsData(page, args)
	local result = h.makeAndRunQuery(page, args)
	return util_map.inPlace(result, util_cargo.extractArgs)
end

function h.makeAndRunQuery(page, args)
	local query = {
		tables = 'ParticipantsArgs',
		orderBy = 'N_TeamInPage',
		where = {
			('OverviewPage="%s"'):format(page),
			util_cargo.whereFromArg('Pool="%s"', Pool.getPool())
		},
		fields = 'Args',
	}
	return util_cargo.getOrderedList(query, 'Args')
end

function h.formatTeamArgs(team)
	team.nocargo = 'Yes'
end

function h.makeOutput(nodes)
	local frame = mw.getCurrentFrame()
	return frame:preprocess('{{Box|start}}'),
		util_table.concat(nodes, frame:preprocess('{{Box|break}}'), tostring),
		frame:preprocess('{{Box|end}}')
end

return p
Advertisement