From 34c655b8028e3a4dda86dd38b7094d24e89e5d01 Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Mon, 26 Aug 2024 11:26:29 +0200 Subject: [PATCH] rename the var on these refactored wikis --- .../wikis/dota2/match_group_input_custom.lua | 52 +++++++++---------- .../match_group_input_custom.lua | 52 +++++++++---------- .../wildrift/match_group_input_custom.lua | 44 ++++++++-------- 3 files changed, 74 insertions(+), 74 deletions(-) diff --git a/components/match2/wikis/dota2/match_group_input_custom.lua b/components/match2/wikis/dota2/match_group_input_custom.lua index dcf7a462df0..821f350d562 100644 --- a/components/match2/wikis/dota2/match_group_input_custom.lua +++ b/components/match2/wikis/dota2/match_group_input_custom.lua @@ -17,7 +17,7 @@ local Streams = require('Module:Links/Stream') local Table = require('Module:Table') local Variables = require('Module:Variables') -local MatchGroupInput = Lua.import('Module:MatchGroup/Input/Util') +local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') local MatchGroupUtil = Lua.import('Module:MatchGroup/Util') local OPPONENT_CONFIG = { @@ -53,9 +53,9 @@ function CustomMatchGroupInput.processMatch(match, options) if not options.isMatchPage then -- See if this match has a standalone match (match page), if so use the data from there local standaloneMatchId = MatchGroupUtil.getStandaloneId(match.bracketid, match.matchid) - local standaloneMatch = standaloneMatchId and MatchGroupInput.fetchStandaloneMatch(standaloneMatchId) or nil + local standaloneMatch = standaloneMatchId and MatchGroupInputUtil.fetchStandaloneMatch(standaloneMatchId) or nil if standaloneMatch then - return MatchGroupInput.mergeStandaloneIntoMatch(match, standaloneMatch) + return MatchGroupInputUtil.mergeStandaloneIntoMatch(match, standaloneMatch) end end @@ -75,20 +75,20 @@ end function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) local finishedInput = match.finished --[[@as string?]] local winnerInput = match.winner --[[@as string?]] - Table.mergeInto(match, MatchGroupInput.readDate(match.date)) + Table.mergeInto(match, MatchGroupInputUtil.readDate(match.date)) local opponents = Array.mapIndexes(function(opponentIndex) - return MatchGroupInput.readOpponent(match, opponentIndex, OPPONENT_CONFIG) + return MatchGroupInputUtil.readOpponent(match, opponentIndex, OPPONENT_CONFIG) end) local games = MatchFunctions.extractMaps(MatchParser, match, #opponents) - match.bestof = MatchGroupInput.getBestOf(match.bestof, games) + match.bestof = MatchGroupInputUtil.getBestOf(match.bestof, games) - local autoScoreFunction = MatchGroupInput.canUseAutoScore(match, games) + local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) and MatchFunctions.calculateMatchScore(games) or nil Array.forEach(opponents, function(opponent, opponentIndex) - opponent.score, opponent.status = MatchGroupInput.computeOpponentScore({ + opponent.score, opponent.status = MatchGroupInputUtil.computeOpponentScore({ walkover = match.walkover, winner = match.winner, opponentIndex = opponentIndex, @@ -96,15 +96,15 @@ function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) }, autoScoreFunction) end) - match.finished = MatchGroupInput.matchIsFinished(match, opponents) + match.finished = MatchGroupInputUtil.matchIsFinished(match, opponents) if match.finished then - match.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponents) - match.walkover = MatchGroupInput.getWalkover(match.resulttype, opponents) - match.winner = MatchGroupInput.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInput.setPlacement(opponents, match.winner, 1, 2) - elseif MatchGroupInput.isNotPlayed(winnerInput, finishedInput) then - match.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponents) + match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) + match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) + match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) + MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2) + elseif MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) then + match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.winner = nil end @@ -141,9 +141,9 @@ function MatchFunctions.extractMaps(MatchParser, match, opponentCount) map.participants = MapFunctions.getParticipants(MatchParser, map, opponentCount) map.extradata = MapFunctions.getExtraData(MatchParser, map, opponentCount) - map.finished = MatchGroupInput.mapIsFinished(map) + map.finished = MatchGroupInputUtil.mapIsFinished(map) local opponentInfo = Array.map(Array.range(1, opponentCount), function(opponentIndex) - local score, status = MatchGroupInput.computeOpponentScore({ + local score, status = MatchGroupInputUtil.computeOpponentScore({ walkover = map.walkover, winner = map.winner, opponentIndex = opponentIndex, @@ -153,10 +153,10 @@ function MatchFunctions.extractMaps(MatchParser, match, opponentCount) end) map.scores = Array.map(opponentInfo, Operator.property('score')) - if map.finished or MatchGroupInput.isNotPlayed(map.winner, finishedInput) then - map.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponentInfo) - map.walkover = MatchGroupInput.getWalkover(map.resulttype, opponentInfo) - map.winner = MatchGroupInput.getWinner(map.resulttype, winnerInput, opponentInfo) + if map.finished or MatchGroupInputUtil.isNotPlayed(map.winner, finishedInput) then + map.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponentInfo) + map.walkover = MatchGroupInputUtil.getWalkover(map.resulttype, opponentInfo) + map.winner = MatchGroupInputUtil.getWinner(map.resulttype, winnerInput, opponentInfo) end table.insert(maps, map) @@ -172,7 +172,7 @@ CustomMatchGroupInput.processMap = FnUtil.identity ---@return fun(opponentIndex: integer): integer function MatchFunctions.calculateMatchScore(maps) return function(opponentIndex) - return MatchGroupInput.computeMatchScoreFromMapWinners(maps, opponentIndex) + return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex) end end @@ -181,7 +181,7 @@ end function MatchFunctions.getTournamentVars(match) match.headtohead = Logic.emptyOr(match.headtohead, Variables.varDefault('headtohead')) match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInput.getCommonTournamentVars(match) + return MatchGroupInputUtil.getCommonTournamentVars(match) end ---@param match table @@ -212,7 +212,7 @@ end ---@return table function MatchFunctions.getExtraData(match) return { - mvp = MatchGroupInput.readMvp(match), + mvp = MatchGroupInputUtil.readMvp(match), headtohead = match.headtohead, } end @@ -226,7 +226,7 @@ function MapFunctions.getExtraData(MatchParser, map, opponentCount) publisherid = map.publisherid or '', comment = map.comment, } - local getCharacterName = FnUtil.curry(MatchGroupInput.getCharacterName, HeroNames) + local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, HeroNames) local function prefixKeyWithTeam(key, opponentIndex) return 'team' .. opponentIndex .. key @@ -266,7 +266,7 @@ end ---@return table function MapFunctions.getParticipants(MatchParser, map, opponentCount) local participants = {} - local getCharacterName = FnUtil.curry(MatchGroupInput.getCharacterName, HeroNames) + local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, HeroNames) for opponentIndex = 1, opponentCount do for playerIndex, participant in ipairs(MatchParser.getParticipants(map, opponentIndex) or {}) do diff --git a/components/match2/wikis/leagueoflegends/match_group_input_custom.lua b/components/match2/wikis/leagueoflegends/match_group_input_custom.lua index 8a675a54ddd..28c94563d81 100644 --- a/components/match2/wikis/leagueoflegends/match_group_input_custom.lua +++ b/components/match2/wikis/leagueoflegends/match_group_input_custom.lua @@ -17,7 +17,7 @@ local Streams = require('Module:Links/Stream') local Table = require('Module:Table') local Variables = require('Module:Variables') -local MatchGroupInput = Lua.import('Module:MatchGroup/Input/Util') +local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') local MatchGroupUtil = Lua.import('Module:MatchGroup/Util') local OPPONENT_CONFIG = { @@ -53,9 +53,9 @@ function CustomMatchGroupInput.processMatch(match, options) if not options.isMatchPage then -- See if this match has a standalone match (match page), if so use the data from there local standaloneMatchId = MatchGroupUtil.getStandaloneId(match.bracketid, match.matchid) - local standaloneMatch = standaloneMatchId and MatchGroupInput.fetchStandaloneMatch(standaloneMatchId) or nil + local standaloneMatch = standaloneMatchId and MatchGroupInputUtil.fetchStandaloneMatch(standaloneMatchId) or nil if standaloneMatch then - return MatchGroupInput.mergeStandaloneIntoMatch(match, standaloneMatch) + return MatchGroupInputUtil.mergeStandaloneIntoMatch(match, standaloneMatch) end end @@ -75,20 +75,20 @@ end function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) local finishedInput = match.finished --[[@as string?]] local winnerInput = match.winner --[[@as string?]] - Table.mergeInto(match, MatchGroupInput.readDate(match.date)) + Table.mergeInto(match, MatchGroupInputUtil.readDate(match.date)) local opponents = Array.mapIndexes(function(opponentIndex) - return MatchGroupInput.readOpponent(match, opponentIndex, OPPONENT_CONFIG) + return MatchGroupInputUtil.readOpponent(match, opponentIndex, OPPONENT_CONFIG) end) local games = MatchFunctions.extractMaps(MatchParser, match, #opponents) - match.bestof = MatchGroupInput.getBestOf(match.bestof, games) + match.bestof = MatchGroupInputUtil.getBestOf(match.bestof, games) - local autoScoreFunction = MatchGroupInput.canUseAutoScore(match, games) + local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) and MatchFunctions.calculateMatchScore(games) or nil Array.forEach(opponents, function(opponent, opponentIndex) - opponent.score, opponent.status = MatchGroupInput.computeOpponentScore({ + opponent.score, opponent.status = MatchGroupInputUtil.computeOpponentScore({ walkover = match.walkover, winner = match.winner, opponentIndex = opponentIndex, @@ -96,15 +96,15 @@ function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) }, autoScoreFunction) end) - match.finished = MatchGroupInput.matchIsFinished(match, opponents) + match.finished = MatchGroupInputUtil.matchIsFinished(match, opponents) if match.finished then - match.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponents) - match.walkover = MatchGroupInput.getWalkover(match.resulttype, opponents) - match.winner = MatchGroupInput.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInput.setPlacement(opponents, match.winner, 1, 2) - elseif MatchGroupInput.isNotPlayed(winnerInput, finishedInput) then - match.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponents) + match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) + match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) + match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) + MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2) + elseif MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) then + match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.winner = nil end @@ -140,9 +140,9 @@ function MatchFunctions.extractMaps(MatchParser, match, opponentCount) map.participants = MapFunctions.getParticipants(MatchParser, map, opponentCount) map.extradata = MapFunctions.getExtraData(MatchParser, map, opponentCount) - map.finished = MatchGroupInput.mapIsFinished(map) + map.finished = MatchGroupInputUtil.mapIsFinished(map) local opponentInfo = Array.map(Array.range(1, opponentCount), function(opponentIndex) - local score, status = MatchGroupInput.computeOpponentScore({ + local score, status = MatchGroupInputUtil.computeOpponentScore({ walkover = map.walkover, winner = map.winner, opponentIndex = opponentIndex, @@ -152,10 +152,10 @@ function MatchFunctions.extractMaps(MatchParser, match, opponentCount) end) map.scores = Array.map(opponentInfo, Operator.property('score')) - if map.finished or MatchGroupInput.isNotPlayed(map.winner, finishedInput) then - map.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponentInfo) - map.walkover = MatchGroupInput.getWalkover(map.resulttype, opponentInfo) - map.winner = MatchGroupInput.getWinner(map.resulttype, winnerInput, opponentInfo) + if map.finished or MatchGroupInputUtil.isNotPlayed(map.winner, finishedInput) then + map.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponentInfo) + map.walkover = MatchGroupInputUtil.getWalkover(map.resulttype, opponentInfo) + map.winner = MatchGroupInputUtil.getWinner(map.resulttype, winnerInput, opponentInfo) end table.insert(maps, map) @@ -171,7 +171,7 @@ CustomMatchGroupInput.processMap = FnUtil.identity ---@return fun(opponentIndex: integer): integer function MatchFunctions.calculateMatchScore(maps) return function(opponentIndex) - return MatchGroupInput.computeMatchScoreFromMapWinners(maps, opponentIndex) + return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex) end end @@ -179,7 +179,7 @@ end ---@return table function MatchFunctions.getTournamentVars(match) match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInput.getCommonTournamentVars(match) + return MatchGroupInputUtil.getCommonTournamentVars(match) end ---@param match table @@ -196,7 +196,7 @@ end ---@return table function MatchFunctions.getExtraData(match) return { - mvp = MatchGroupInput.readMvp(match), + mvp = MatchGroupInputUtil.readMvp(match), } end @@ -208,7 +208,7 @@ function MapFunctions.getExtraData(MatchParser, map, opponentCount) local extraData = { comment = map.comment, } - local getCharacterName = FnUtil.curry(MatchGroupInput.getCharacterName, HeroNames) + local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, HeroNames) local function prefixKeyWithTeam(key, opponentIndex) return 'team' .. opponentIndex .. key @@ -248,7 +248,7 @@ end ---@return table function MapFunctions.getParticipants(MatchParser, map, opponentCount) local participants = {} - local getCharacterName = FnUtil.curry(MatchGroupInput.getCharacterName, HeroNames) + local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, HeroNames) for opponentIndex = 1, opponentCount do for playerIndex, participant in ipairs(MatchParser.getParticipants(map, opponentIndex) or {}) do diff --git a/components/match2/wikis/wildrift/match_group_input_custom.lua b/components/match2/wikis/wildrift/match_group_input_custom.lua index 514f227cd2c..c7246d2e594 100644 --- a/components/match2/wikis/wildrift/match_group_input_custom.lua +++ b/components/match2/wikis/wildrift/match_group_input_custom.lua @@ -16,7 +16,7 @@ local Table = require('Module:Table') local Variables = require('Module:Variables') local Streams = require('Module:Links/Stream') -local MatchGroupInput = Lua.import('Module:MatchGroup/Input/Util') +local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') local MAX_NUM_PLAYERS = 5 local DEFAULT_BESTOF = 3 @@ -42,23 +42,23 @@ local CustomMatchGroupInput = {} function CustomMatchGroupInput.processMatch(match, options) local finishedInput = match.finished --[[@as string?]] local winnerInput = match.winner --[[@as string?]] - Table.mergeInto(match, MatchGroupInput.readDate(match.date, { + Table.mergeInto(match, MatchGroupInputUtil.readDate(match.date, { 'tournament_enddate', 'tournament_startdate', })) local opponents = Array.mapIndexes(function(opponentIndex) - return MatchGroupInput.readOpponent(match, opponentIndex, OPPONENT_CONFIG) + return MatchGroupInputUtil.readOpponent(match, opponentIndex, OPPONENT_CONFIG) end) local games = CustomMatchGroupInput.extractMaps(match, #opponents) match.bestof = MatchFunctions.getBestOf(match) - local autoScoreFunction = MatchGroupInput.canUseAutoScore(match, games) + local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) and MatchFunctions.calculateMatchScore(games) or nil Array.forEach(opponents, function(opponent, opponentIndex) - opponent.score, opponent.status = MatchGroupInput.computeOpponentScore({ + opponent.score, opponent.status = MatchGroupInputUtil.computeOpponentScore({ walkover = match.walkover, winner = match.winner, opponentIndex = opponentIndex, @@ -66,15 +66,15 @@ function CustomMatchGroupInput.processMatch(match, options) }, autoScoreFunction) end) - match.finished = MatchGroupInput.matchIsFinished(match, opponents) + match.finished = MatchGroupInputUtil.matchIsFinished(match, opponents) if match.finished then - match.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponents) - match.walkover = MatchGroupInput.getWalkover(match.resulttype, opponents) - match.winner = MatchGroupInput.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInput.setPlacement(opponents, match.winner, 1, 2) - elseif MatchGroupInput.isNotPlayed(winnerInput, finishedInput) then - match.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponents) + match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) + match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) + match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) + MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2) + elseif MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) then + match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.winner = nil end @@ -105,9 +105,9 @@ function CustomMatchGroupInput.extractMaps(match, opponentCount) map.extradata = MapFunctions.getExtraData(map, opponentCount) - map.finished = MatchGroupInput.mapIsFinished(map) + map.finished = MatchGroupInputUtil.mapIsFinished(map) local opponentInfo = Array.map(Array.range(1, opponentCount), function(opponentIndex) - local score, status = MatchGroupInput.computeOpponentScore({ + local score, status = MatchGroupInputUtil.computeOpponentScore({ walkover = map.walkover, winner = map.winner, opponentIndex = opponentIndex, @@ -117,10 +117,10 @@ function CustomMatchGroupInput.extractMaps(match, opponentCount) end) map.scores = Array.map(opponentInfo, Operator.property('score')) - if map.finished or MatchGroupInput.isNotPlayed(map.winner, finishedInput) then - map.resulttype = MatchGroupInput.getResultType(winnerInput, finishedInput, opponentInfo) - map.walkover = MatchGroupInput.getWalkover(map.resulttype, opponentInfo) - map.winner = MatchGroupInput.getWinner(map.resulttype, winnerInput, opponentInfo) + if map.finished or MatchGroupInputUtil.isNotPlayed(map.winner, finishedInput) then + map.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponentInfo) + map.walkover = MatchGroupInputUtil.getWalkover(map.resulttype, opponentInfo) + map.winner = MatchGroupInputUtil.getWinner(map.resulttype, winnerInput, opponentInfo) end table.insert(maps, map) @@ -140,7 +140,7 @@ CustomMatchGroupInput.processMap = FnUtil.identity ---@return fun(opponentIndex: integer): integer function MatchFunctions.calculateMatchScore(maps) return function(opponentIndex) - return MatchGroupInput.computeMatchScoreFromMapWinners(maps, opponentIndex) + return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex) end end @@ -156,7 +156,7 @@ end ---@return table function MatchFunctions.getTournamentVars(match) match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInput.getCommonTournamentVars(match) + return MatchGroupInputUtil.getCommonTournamentVars(match) end ---@param match table @@ -171,7 +171,7 @@ end ---@return table function MatchFunctions.getExtraData(match) return { - mvp = MatchGroupInput.readMvp(match), + mvp = MatchGroupInputUtil.readMvp(match), } end @@ -188,7 +188,7 @@ function MapFunctions.getExtraData(map, opponentCount) comment = map.comment, } - local getCharacterName = FnUtil.curry(MatchGroupInput.getCharacterName, ChampionNames) + local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, ChampionNames) for opponentIndex = 1, opponentCount do extraData['team' .. opponentIndex .. 'side'] = string.lower(map['team' .. opponentIndex .. 'side'] or '')