Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions lua/wikis/commons/PrizePool/Base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local Lpdb = Lua.import('Module:Lpdb')
local PageVariableNamespace = Lua.import('Module:PageVariableNamespace')
local String = Lua.import('Module:StringUtils')
local Table = Lua.import('Module:Table')
local Tournament = Lua.import('Module:Tournament')
local Variables = Lua.import('Module:Variables')

local Currency = Lua.import('Module:Currency')
Expand Down Expand Up @@ -255,20 +256,18 @@ BasePrizePool.prizeTypes = {

header = 'qualifies',
headerParse = function (prizePool, input, context, index)
local link = mw.ext.TeamLiquidIntegration.resolve_redirect(input):gsub(' ', '_')

-- Automatically retrieve information from the Tournament
local tournamentData = BasePrizePool._getTournamentInfo(link) or {}
local tournamentData = Tournament.getTournament(input) or {}
local prefix = 'qualifies' .. index
return {
link = link,
title = context[prefix .. 'name'] or Logic.emptyOr(
tournamentData.tickername,
tournamentData.name,
(tournamentData.pagename or link):gsub('_', ' '):gsub('/', ' ')
link = tournamentData.pageName or input:gsub(' ', '_'),
title = Logic.emptyOr(
context[prefix .. 'name'],
tournamentData.displayName,
input:gsub('_', ' '):gsub('/', ' ')
),
icon = tournamentData.icon or context[prefix .. 'icon'],
iconDark = tournamentData.icondark or context[prefix .. 'icondark']
iconDark = tournamentData.iconDark or context[prefix .. 'icondark']
}
end,
headerDisplay = function (data)
Expand Down Expand Up @@ -842,16 +841,6 @@ function BasePrizePool:assertOpponentStructType(typeStruct)
end
end

--- Fetches the LPDB object of a tournament
---@param pageName string
---@return tournament
function BasePrizePool._getTournamentInfo(pageName)
return mw.ext.LiquipediaDB.lpdb('tournament', {
conditions = '[[pagename::' .. pageName .. ']]',
limit = 1,
})[1]
end

--- Returns the default date based on wiki-variables set in the Infobox League
---@return string
function BasePrizePool._getTournamentDate()
Expand Down
Loading