From 3f97ec1c761e12c078ea8712970f0b11da044740 Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Mon, 21 Oct 2024 17:56:10 +0200 Subject: [PATCH] refactor(match2): standardize character parsing in moba match summaries (#4916) * refactor(match2): standardize character parsing in moba match summaries * update annos to match new logic --- .../match2/commons/match_summary_base.lua | 37 ++++++++----------- .../match2/wikis/deadlock/match_summary.lua | 10 ++--- .../match2/wikis/dota2/match_summary.lua | 26 ++++--------- .../match2/wikis/heroes/match_summary.lua | 28 ++++---------- .../wikis/honorofkings/match_summary.lua | 28 ++++---------- .../wikis/leagueoflegends/match_summary.lua | 28 ++++---------- .../wikis/mobilelegends/match_summary.lua | 28 ++++---------- .../match2/wikis/pokemon/match_summary.lua | 21 ++++------- .../match2/wikis/smite/match_summary.lua | 28 ++++---------- .../match2/wikis/wildrift/match_summary.lua | 28 ++++---------- ...dget_match_summary_character_ban_table.lua | 7 ++-- 11 files changed, 86 insertions(+), 183 deletions(-) diff --git a/components/match2/commons/match_summary_base.lua b/components/match2/commons/match_summary_base.lua index a43c8aa7ca2..42092704a01 100644 --- a/components/match2/commons/match_summary_base.lua +++ b/components/match2/commons/match_summary_base.lua @@ -840,32 +840,25 @@ end ---@param games table[] ---@param maxNumberOfBans integer ----@return {[1]: string[]?, [2]: string[]?}[]? +---@return {[1]: string[], [2]: string[]}[] function MatchSummary.buildCharacterBanData(games, maxNumberOfBans) - local matchHasBans = false - local gamesBans = Array.map(games, function(game) + return Array.map(games, function(game) local extradata = game.extradata or {} - local banData = {{}, {}} - local gameHasBans = false - for index = 1, maxNumberOfBans do - local team1ban = String.nilIfEmpty(extradata['team1ban' .. index]) - local team2ban = String.nilIfEmpty(extradata['team2ban' .. index]) - if team1ban or team2ban then - gameHasBans = true - end - table.insert(banData[1], team1ban) - table.insert(banData[2], team2ban) - end - - if gameHasBans then - matchHasBans = true - return banData - else - return {} - end + return { + MatchSummary.buildCharacterList(extradata, 'team1ban', maxNumberOfBans), + MatchSummary.buildCharacterList(extradata, 'team2ban', maxNumberOfBans), + } end) +end - return matchHasBans and gamesBans or nil +---@param data table +---@param prefix string +---@param maxNumberOfCharacters integer +---@return string[] +function MatchSummary.buildCharacterList(data, prefix, maxNumberOfCharacters) + return Array.map(Array.range(1, maxNumberOfCharacters), function(index) + return data[prefix .. index] + end) end return MatchSummary diff --git a/components/match2/wikis/deadlock/match_summary.lua b/components/match2/wikis/deadlock/match_summary.lua index 2fe5b2c1561..4250824e62b 100644 --- a/components/match2/wikis/deadlock/match_summary.lua +++ b/components/match2/wikis/deadlock/match_summary.lua @@ -52,12 +52,10 @@ function CustomMatchSummary.createBody(match) -- Add the Hero Bans local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS) - if characterBansData then - body.root:node(MatchSummaryWidgets.CharacterBanTable{ - bans = characterBansData, - date = match.date, - }) - end + body.root:node(MatchSummaryWidgets.CharacterBanTable{ + bans = characterBansData, + date = match.date, + }) return body end diff --git a/components/match2/wikis/dota2/match_summary.lua b/components/match2/wikis/dota2/match_summary.lua index 60b1984c87c..a148ac72432 100644 --- a/components/match2/wikis/dota2/match_summary.lua +++ b/components/match2/wikis/dota2/match_summary.lua @@ -13,7 +13,6 @@ local Icon = require('Module:Icon') local Logic = require('Module:Logic') local Lua = require('Module:Lua') local MatchLinks = mw.loadData('Module:MatchLinks') -local String = require('Module:StringUtils') local Table = require('Module:Table') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') @@ -23,8 +22,7 @@ local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') local Opponent = Lua.import('Module:Opponent') local MAX_NUM_BANS = 7 -local NUM_HEROES_PICK_TEAM = 5 -local NUM_HEROES_PICK_SOLO = 1 +local NUM_HEROES_PICK = 5 local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'} local NO_CHECK = '[[File:NoCheck.png|link=]]' @@ -105,19 +103,11 @@ function CustomMatchSummary._createGame(game, gameIndex) local row = MatchSummary.Row() local extradata = game.extradata or {} - local numberOfHeroes = NUM_HEROES_PICK_TEAM - if game.mode == Opponent.solo then - numberOfHeroes = NUM_HEROES_PICK_SOLO - end - local heroesData = {{}, {}} - for heroIndex = 1, numberOfHeroes do - if String.isNotEmpty(extradata['team1hero' .. heroIndex]) then - heroesData[1][heroIndex] = extradata['team1hero' .. heroIndex] - end - if String.isNotEmpty(extradata['team2hero' .. heroIndex]) then - heroesData[2][heroIndex] = extradata['team2hero' .. heroIndex] - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1hero', NUM_HEROES_PICK), + MatchSummary.buildCharacterList(extradata, 'team2hero', NUM_HEROES_PICK), + } row:addClass('brkts-popup-body-game') :css('font-size', '80%') @@ -125,7 +115,7 @@ function CustomMatchSummary._createGame(game, gameIndex) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, - characters = heroesData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -139,7 +129,7 @@ function CustomMatchSummary._createGame(game, gameIndex) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 2)) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, - characters = heroesData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/heroes/match_summary.lua b/components/match2/wikis/heroes/match_summary.lua index 0eaf06a92e2..f1bab92d31d 100644 --- a/components/match2/wikis/heroes/match_summary.lua +++ b/components/match2/wikis/heroes/match_summary.lua @@ -18,7 +18,6 @@ local Icon = require('Module:Icon') local Logic = require('Module:Logic') local Lua = require('Module:Lua') local Page = require('Module:Page') -local String = require('Module:StringUtils') local Table = require('Module:Table') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -125,24 +124,13 @@ function CustomMatchSummary._createGame(game, gameIndex, date) local row = MatchSummary.Row() local extradata = game.extradata or {} - local championsData = {{}, {}} - local championsDataIsEmpty = true - for champIndex = 1, NUM_CHAMPIONS_PICK do - if String.isNotEmpty(extradata['team1champion' .. champIndex]) then - championsData[1][champIndex] = extradata['team1champion' .. champIndex] - championsDataIsEmpty = false - end - if String.isNotEmpty(extradata['team2champion' .. champIndex]) then - championsData[2][champIndex] = extradata['team2champion' .. champIndex] - championsDataIsEmpty = false - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1champion', NUM_CHAMPIONS_PICK), + MatchSummary.buildCharacterList(extradata, 'team2champion', NUM_CHAMPIONS_PICK), + } - if - Logic.isEmpty(game.length) and - Logic.isEmpty(game.winner) and - championsDataIsEmpty - then + if Logic.isEmpty(game.length) and Logic.isEmpty(game.winner) and Logic.isDeepEmpty(characterData) then return nil end @@ -154,7 +142,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, date = date, - characters = championsData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -172,7 +160,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, date = date, - characters = championsData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/honorofkings/match_summary.lua b/components/match2/wikis/honorofkings/match_summary.lua index 344435f5aaf..72877c8fb7b 100644 --- a/components/match2/wikis/honorofkings/match_summary.lua +++ b/components/match2/wikis/honorofkings/match_summary.lua @@ -14,7 +14,6 @@ local ExternalLinks = require('Module:ExternalLinks') local Icon = require('Module:Icon') local Logic = require('Module:Logic') local Lua = require('Module:Lua') -local String = require('Module:StringUtils') local Table = require('Module:Table') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -92,24 +91,13 @@ function CustomMatchSummary._createGame(game, gameIndex, date) local row = MatchSummary.Row() local extradata = game.extradata or {} - local championsData = {{}, {}} - local championsDataIsEmpty = true - for champIndex = 1, NUM_CHAMPIONS_PICK do - if String.isNotEmpty(extradata['team1champion' .. champIndex]) then - championsData[1][champIndex] = extradata['team1champion' .. champIndex] - championsDataIsEmpty = false - end - if String.isNotEmpty(extradata['team2champion' .. champIndex]) then - championsData[2][champIndex] = extradata['team2champion' .. champIndex] - championsDataIsEmpty = false - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1champion', NUM_CHAMPIONS_PICK), + MatchSummary.buildCharacterList(extradata, 'team2champion', NUM_CHAMPIONS_PICK), + } - if - Logic.isEmpty(game.length) and - Logic.isEmpty(game.winner) and - championsDataIsEmpty - then + if Logic.isEmpty(game.length) and Logic.isEmpty(game.winner) and Logic.isDeepEmpty(characterData) then return nil end @@ -120,7 +108,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, date = date, - characters = championsData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -135,7 +123,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, date = date, - characters = championsData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/leagueoflegends/match_summary.lua b/components/match2/wikis/leagueoflegends/match_summary.lua index 60a7897e24d..2aa88b95cf7 100644 --- a/components/match2/wikis/leagueoflegends/match_summary.lua +++ b/components/match2/wikis/leagueoflegends/match_summary.lua @@ -13,18 +13,15 @@ local Icon = require('Module:Icon') local Logic = require('Module:Logic') local Lua = require('Module:Lua') local MatchLinks = mw.loadData('Module:MatchLinks') -local String = require('Module:StringUtils') local Table = require('Module:Table') local MatchPage = Lua.import('Module:MatchPage') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') -local Opponent = Lua.import('Module:Opponent') local MAX_NUM_BANS = 5 -local NUM_HEROES_PICK_TEAM = 5 -local NUM_HEROES_PICK_SOLO = 1 +local NUM_HEROES_PICK = 5 local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'} local NO_CHECK = '[[File:NoCheck.png|link=]]' @@ -92,20 +89,11 @@ function CustomMatchSummary._createGame(game, gameIndex, date) local row = MatchSummary.Row() local extradata = game.extradata or {} - local numberOfHeroes = NUM_HEROES_PICK_TEAM - if game.mode == Opponent.solo then - numberOfHeroes = NUM_HEROES_PICK_SOLO - end - - local heroesData = {{}, {}} - for heroIndex = 1, numberOfHeroes do - if String.isNotEmpty(extradata['team1champion' .. heroIndex]) then - heroesData[1][heroIndex] = extradata['team1champion' .. heroIndex] - end - if String.isNotEmpty(extradata['team2champion' .. heroIndex]) then - heroesData[2][heroIndex] = extradata['team2champion' .. heroIndex] - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1champion', NUM_HEROES_PICK), + MatchSummary.buildCharacterList(extradata, 'team2champion', NUM_HEROES_PICK), + } row:addClass('brkts-popup-body-game') :css('font-size', '80%') @@ -115,7 +103,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, date = date, - characters = heroesData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -130,7 +118,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, date = date, - characters = heroesData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/mobilelegends/match_summary.lua b/components/match2/wikis/mobilelegends/match_summary.lua index 0d9028c8211..76d9af9c772 100644 --- a/components/match2/wikis/mobilelegends/match_summary.lua +++ b/components/match2/wikis/mobilelegends/match_summary.lua @@ -15,7 +15,6 @@ local Logic = require('Module:Logic') local Lua = require('Module:Lua') local Table = require('Module:Table') local ExternalLinks = require('Module:ExternalLinks') -local String = require('Module:StringUtils') local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') @@ -95,24 +94,13 @@ function CustomMatchSummary._createGame(game, gameIndex, date) local row = MatchSummary.Row() local extradata = game.extradata or {} - local championsData = {{}, {}} - local championsDataIsEmpty = true - for champIndex = 1, NUM_CHAMPIONS_PICK do - if String.isNotEmpty(extradata['team1champion' .. champIndex]) then - championsData[1][champIndex] = extradata['team1champion' .. champIndex] - championsDataIsEmpty = false - end - if String.isNotEmpty(extradata['team2champion' .. champIndex]) then - championsData[2][champIndex] = extradata['team2champion' .. champIndex] - championsDataIsEmpty = false - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1champion', NUM_CHAMPIONS_PICK), + MatchSummary.buildCharacterList(extradata, 'team2champion', NUM_CHAMPIONS_PICK), + } - if - Logic.isEmpty(game.length) and - Logic.isEmpty(game.winner) and - championsDataIsEmpty - then + if Logic.isEmpty(game.length) and Logic.isEmpty(game.winner) and Logic.isDeepEmpty(characterData) then return nil end @@ -123,7 +111,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, date = date, - characters = championsData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -138,7 +126,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, date = date, - characters = championsData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/pokemon/match_summary.lua b/components/match2/wikis/pokemon/match_summary.lua index 4027b898826..12a58e10e26 100644 --- a/components/match2/wikis/pokemon/match_summary.lua +++ b/components/match2/wikis/pokemon/match_summary.lua @@ -15,8 +15,6 @@ local Logic = require('Module:Logic') local Lua = require('Module:Lua') local Table = require('Module:Table') local ExternalLinks = require('Module:ExternalLinks') -local String = require('Module:StringUtils') -local Array = require('Module:Array') local Abbreviation = require('Module:Abbreviation') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -94,16 +92,13 @@ function CustomMatchSummary._createGame(game, gameIndex, date) local row = MatchSummary.Row() local extradata = game.extradata or {} - local getChampsForTeam = function(team) - local getChampFromIndex = function(champIndex) - return champIndex, String.nilIfEmpty(extradata['team' .. team .. 'champion' .. champIndex]) - end - return Table.map(Array.range(1, NUM_CHAMPIONS_PICK), getChampFromIndex) - end - local championsData = Array.map(Array.range(1, 2), getChampsForTeam)--[[@as table]] - local championsDataIsEmpty = Array.all(championsData, Table.isEmpty) + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1champion', NUM_CHAMPIONS_PICK), + MatchSummary.buildCharacterList(extradata, 'team2champion', NUM_CHAMPIONS_PICK), + } - if Table.isEmpty(game.scores) and Logic.isEmpty(game.winner) and championsDataIsEmpty then + if Logic.isEmpty(game.scores) and Logic.isEmpty(game.winner) and Logic.isDeepEmpty(characterData) then return nil end @@ -119,7 +114,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, date = date, - characters = championsData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -134,7 +129,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, date = date, - characters = championsData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/smite/match_summary.lua b/components/match2/wikis/smite/match_summary.lua index 4fb861b7fe2..c06a6009a8c 100644 --- a/components/match2/wikis/smite/match_summary.lua +++ b/components/match2/wikis/smite/match_summary.lua @@ -13,16 +13,13 @@ local DateExt = require('Module:Date/Ext') local Icon = require('Module:Icon') local Logic = require('Module:Logic') local Lua = require('Module:Lua') -local String = require('Module:StringUtils') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') -local Opponent = Lua.import('Module:Opponent') local MAX_NUM_BANS = 5 -local NUM_GODS_PICK_TEAM = 5 -local NUM_GODS_PICK_SOLO = 1 +local NUM_GODS_PICK = 5 local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'} local NO_CHECK = '[[File:NoCheck.png|link=]]' @@ -79,20 +76,11 @@ function CustomMatchSummary._createGame(game, gameIndex, date) local row = MatchSummary.Row() local extradata = game.extradata or {} - local numberOfGods = NUM_GODS_PICK_TEAM - if game.mode == Opponent.solo then - numberOfGods = NUM_GODS_PICK_SOLO - end - - local godsData = {{}, {}} - for godIndex = 1, numberOfGods do - if String.isNotEmpty(extradata['team1god' .. godIndex]) then - godsData[1][godIndex] = extradata['team1god' .. godIndex] - end - if String.isNotEmpty(extradata['team2god' .. godIndex]) then - godsData[2][godIndex] = extradata['team2god' .. godIndex] - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1god', NUM_GODS_PICK), + MatchSummary.buildCharacterList(extradata, 'team2god', NUM_GODS_PICK), + } row:addClass('brkts-popup-body-game') :css('font-size', '80%') @@ -101,7 +89,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, - characters = godsData[1], + characters = characterData[1], date = date, bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) @@ -116,7 +104,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 2)) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, - characters = godsData[2], + characters = characterData[2], date = date, bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/match2/wikis/wildrift/match_summary.lua b/components/match2/wikis/wildrift/match_summary.lua index 0ea87d35ec1..676e1144051 100644 --- a/components/match2/wikis/wildrift/match_summary.lua +++ b/components/match2/wikis/wildrift/match_summary.lua @@ -14,7 +14,6 @@ local Logic = require('Module:Logic') local Lua = require('Module:Lua') local Table = require('Module:Table') local ExternalLinks = require('Module:ExternalLinks') -local String = require('Module:StringUtils') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -91,24 +90,13 @@ function CustomMatchSummary._createGame(game, gameIndex) local row = MatchSummary.Row() local extradata = game.extradata or {} - local championsData = {{}, {}} - local championsDataIsEmpty = true - for champIndex = 1, NUM_CHAMPIONS_PICK do - if String.isNotEmpty(extradata['team1champion' .. champIndex]) then - championsData[1][champIndex] = extradata['team1champion' .. champIndex] - championsDataIsEmpty = false - end - if String.isNotEmpty(extradata['team2champion' .. champIndex]) then - championsData[2][champIndex] = extradata['team2champion' .. champIndex] - championsDataIsEmpty = false - end - end + -- TODO: Change to use participant data + local characterData = { + MatchSummary.buildCharacterList(extradata, 'team1champion', NUM_CHAMPIONS_PICK), + MatchSummary.buildCharacterList(extradata, 'team2champion', NUM_CHAMPIONS_PICK), + } - if - Logic.isEmpty(game.length) and - Logic.isEmpty(game.winner) and - championsDataIsEmpty - then + if Logic.isEmpty(game.length) and Logic.isEmpty(game.winner) and Logic.isDeepEmpty(characterData) then return nil end @@ -118,7 +106,7 @@ function CustomMatchSummary._createGame(game, gameIndex) row:addElement(MatchSummaryWidgets.Characters{ flipped = false, - characters = championsData[1], + characters = characterData[1], bg = 'brkts-popup-side-color-' .. (extradata.team1side or ''), }) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 1)) @@ -132,7 +120,7 @@ function CustomMatchSummary._createGame(game, gameIndex) row:addElement(CustomMatchSummary._createCheckMark(game.winner == 2)) row:addElement(MatchSummaryWidgets.Characters{ flipped = true, - characters = championsData[2], + characters = characterData[2], bg = 'brkts-popup-side-color-' .. (extradata.team2side or ''), }) diff --git a/components/widget/match/summary/widget_match_summary_character_ban_table.lua b/components/widget/match/summary/widget_match_summary_character_ban_table.lua index a7bc5ec963d..1b7809cc7ef 100644 --- a/components/widget/match/summary/widget_match_summary_character_ban_table.lua +++ b/components/widget/match/summary/widget_match_summary_character_ban_table.lua @@ -14,7 +14,6 @@ local Lua = require('Module:Lua') local Widget = Lua.import('Module:Widget') local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Div, Abbr, Tr, Th, Td = HtmlWidgets.Div, HtmlWidgets.Abbr, HtmlWidgets.Tr, HtmlWidgets.Th, HtmlWidgets.Td -local Table = HtmlWidgets.Table local Characters = Lua.import('Module:Widget/Match/Summary/Characters') ---@class MatchSummaryCharacterBanTable: Widget @@ -26,12 +25,12 @@ MatchSummaryCharacterBanTable.defaultProps = { ---@return Widget[]? function MatchSummaryCharacterBanTable:render() - if Logic.isEmpty(self.props.bans) then + if Logic.isDeepEmpty(self.props.bans) then return nil end local rows = Array.map(self.props.bans, function(banData, gameNumber) - if Logic.isEmpty(banData) then + if Logic.isDeepEmpty(banData) then return nil end return Tr{ @@ -58,7 +57,7 @@ function MatchSummaryCharacterBanTable:render() return Div{ classes = {'brkts-popup-mapveto'}, children = { - Table{ + HtmlWidgets.Table{ classes = {'wikitable-striped', 'collapsible', 'collapsed'}, children = { Tr{children = {