Skip to content

Commit

Permalink
feat(match2): remove defaultIcon for characterBans (#4909)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz authored Oct 18, 2024
1 parent 6bb9a37 commit 26c5f38
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 18 deletions.
7 changes: 3 additions & 4 deletions components/match2/commons/match_summary_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,8 @@ end

---@param games table[]
---@param maxNumberOfBans integer
---@param defaultIcon string?
---@return {[1]: string[]?, [2]: string[]?}[]?
function MatchSummary.buildCharacterBanData(games, maxNumberOfBans, defaultIcon)
function MatchSummary.buildCharacterBanData(games, maxNumberOfBans)
local matchHasBans = false
local gamesBans = Array.map(games, function(game)
local extradata = game.extradata or {}
Expand All @@ -854,8 +853,8 @@ function MatchSummary.buildCharacterBanData(games, maxNumberOfBans, defaultIcon)
if team1ban or team2ban then
gameHasBans = true
end
table.insert(banData[1], team1ban or defaultIcon)
table.insert(banData[2], team2ban or defaultIcon)
table.insert(banData[1], team1ban)
table.insert(banData[2], team2ban)
end

if gameHasBans then
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/heroes/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All')

local MAX_NUM_BANS = 3
local NUM_CHAMPIONS_PICK = 5
local NO_CHARACTER = 'default'

local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
Expand Down Expand Up @@ -106,7 +105,7 @@ function CustomMatchSummary.createBody(match)
body:addRow(MatchSummary.makeCastersRow(match.extradata.casters))

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/honorofkings/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ local NUM_CHAMPIONS_PICK = 5

local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
local NO_CHARACTER = 'default'

---@param args table
---@return Html
Expand Down Expand Up @@ -76,7 +75,7 @@ function CustomMatchSummary.createBody(match)
end

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/leagueoflegends/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ local NUM_HEROES_PICK_TEAM = 5
local NUM_HEROES_PICK_SOLO = 1
local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
local NO_CHARACTER = 'default'

---@param args table
---@return Html
Expand Down Expand Up @@ -76,7 +75,7 @@ function CustomMatchSummary.createBody(match)
end

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/mobilelegends/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ local NUM_CHAMPIONS_PICK = 5

local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
local NO_CHARACTER = 'default'

---@param args table
---@return Html
Expand Down Expand Up @@ -79,7 +78,7 @@ function CustomMatchSummary.createBody(match)
body:addRow(MatchSummary.makeCastersRow(match.extradata.casters))

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/pokemon/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All')

local MAX_NUM_BANS = 5
local NUM_CHAMPIONS_PICK = 5
local NO_CHARACTER = 'default'

local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
Expand Down Expand Up @@ -78,7 +77,7 @@ function CustomMatchSummary.createBody(match)
end

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/smite/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ local NUM_GODS_PICK_TEAM = 5
local NUM_GODS_PICK_SOLO = 1
local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
local NO_CHARACTER = 'default'

local LINK_DATA = {
smiteesports = {
Expand Down Expand Up @@ -63,7 +62,7 @@ function CustomMatchSummary.createBody(match)
body:addRow(MatchSummary.makeCastersRow(match.extradata.casters))

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down
3 changes: 1 addition & 2 deletions components/match2/wikis/wildrift/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All')

local MAX_NUM_BANS = 5
local NUM_CHAMPIONS_PICK = 5
local NO_CHARACTER = 'default'

local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}
local NO_CHECK = '[[File:NoCheck.png|link=]]'
Expand Down Expand Up @@ -76,7 +75,7 @@ function CustomMatchSummary.createBody(match)
end

-- Add the Character Bans
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS, NO_CHARACTER)
local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS)
body.root:node(MatchSummaryWidgets.CharacterBanTable{
bans = characterBansData,
date = match.date,
Expand Down

0 comments on commit 26c5f38

Please sign in to comment.