Skip to content

Commit be66419

Browse files
committed
comments
1 parent 103f892 commit be66419

8 files changed

Lines changed: 19 additions & 18 deletions

File tree

‎lua/wikis/commons/MatchSummary/Base.lua‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ end
6060

6161
-- Default body function
6262
---@param match MatchGroupUtilMatch
63-
---@param createGames fun(match: MatchGroupUtilMatch): Renderable|Renderable[]?
64-
---@param createGame fun(date: string, game: table, gameIndex: integer): Renderable|Renderable[]
63+
---@param createGames? fun(match: MatchGroupUtilMatch): Renderable|Renderable[]?
64+
---@param createGame? fun(date: string, game: table, gameIndex: integer): Renderable|Renderable[]
6565
---@param options {maxBans: integer?}?
6666
---@return Renderable[]
6767
function MatchSummary.createDefaultBody(match, createGames, createGame, options)
@@ -70,6 +70,8 @@ function MatchSummary.createDefaultBody(match, createGames, createGame, options)
7070
local characterBansData = MatchSummary.buildCharacterBanData(match.games, options.maxBans or 0)
7171

7272
return WidgetUtil.collect(
73+
--- we assume that createGames and createGame are mutually exclusive, so we can safely call one or the other
74+
---@diagnostic disable-next-line: param-type-mismatch
7375
createGames and createGames(match) or Array.map(match.games, FnUtil.curry(createGame, match.date)),
7476
MatchSummaryWidgets.Mvp(match.extradata.mvp),
7577
MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = match.game})),
@@ -221,7 +223,7 @@ function MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, options)
221223
type(CustomMatchSummary.createGame) == 'function' or
222224
type(CustomMatchSummary.createGames) == 'function'
223225
),
224-
'createBody or createGame or createGames must be implemented in Module:MatchSummary'
226+
'One of createBody or createGame or createGames must be implemented in Module:MatchSummary'
225227
)
226228

227229
options = options or {}

‎lua/wikis/deadlock/MatchSummary.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function CustomMatchSummary.getByMatchId(args)
4040
end
4141

4242
---@param match MatchGroupUtilMatch
43-
---@return VNode[]
43+
---@return VNode
4444
function CustomMatchSummary.createGames(match)
4545
return MatchSummaryWidgets.GamesContainer{
4646
children = Array.map(match.games, function (game, gameIndex)

‎lua/wikis/dota2/MatchSummary.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function CustomMatchSummary.getByMatchId(args)
3434
end
3535

3636
---@param match MatchGroupUtilMatch
37-
---@return VNode[]
37+
---@return VNode
3838
function CustomMatchSummary.createGames(match)
3939
return MatchSummaryWidgets.GamesContainer{
4040
children = Array.map(match.games, function (game, gameIndex)

‎lua/wikis/honorofkings/MatchSummary.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function CustomMatchSummary.getByMatchId(args)
3434
end
3535

3636
---@param match MatchGroupUtilMatch
37-
---@return VNode[]
37+
---@return VNode
3838
function CustomMatchSummary.createGames(match)
3939
---@param game MatchGroupUtilGame
4040
---@return boolean

‎lua/wikis/lab/MatchSummary.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function CustomMatchSummary.getByMatchId(args)
2929
end
3030

3131
---@param match MatchGroupUtilMatch
32-
---@return VNode[]
32+
---@return VNode
3333
function CustomMatchSummary.createGames(match)
3434
return MatchSummaryWidgets.GamesContainer{
3535
children = Array.map(match.games, function (game, gameIndex)

‎lua/wikis/mobilelegends/MatchSummary.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function CustomMatchSummary.getByMatchId(args)
3434
end
3535

3636
---@param match MatchGroupUtilMatch
37-
---@return VNode[]
37+
---@return VNode
3838
function CustomMatchSummary.createGames(match)
3939
---@param game MatchGroupUtilGame
4040
---@return boolean

‎lua/wikis/overwatch/MatchSummary.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function CustomMatchSummary.getByMatchId(args)
3232
end
3333

3434
---@param match MatchGroupUtilMatch
35-
---@return VNode[]
35+
---@return VNode
3636
function CustomMatchSummary.createGames(match)
3737
return MatchSummaryWidgets.GamesContainer{
3838
children = Array.map(match.games, function (game, gameIndex)
@@ -57,6 +57,7 @@ function GameRowComponentProps.createGameOpponentView(props, opponentIndex)
5757
local game = props.game
5858
local opponentCopy = Table.deepCopy(game.opponents[opponentIndex])
5959
if opponentCopy.score and game.mode == 'Push' then
60+
---@diagnostic disable-next-line: assign-type-mismatch
6061
opponentCopy.score = opponentCopy.score .. 'm'
6162
end
6263

‎lua/wikis/smash/MatchSummary.lua‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ end
4242
---@param match MatchGroupUtilMatch
4343
---@return Renderable[]
4444
function CustomMatchSummary.createGames(match)
45-
return WidgetUtil.collect(
46-
Array.map(match.games, function(game)
47-
return CustomMatchSummary._createStandardGame(game, {
48-
opponents = match.opponents,
49-
game = match.game,
50-
teamMode = CustomMatchSummary.isTeam(match),
51-
})
52-
end)
53-
)
45+
return Array.map(match.games, function(game)
46+
return CustomMatchSummary._createStandardGame(game, {
47+
opponents = match.opponents,
48+
game = match.game,
49+
teamMode = CustomMatchSummary.isTeam(match),
50+
})
51+
end)
5452
end
5553

5654
---@param game MatchGroupUtilGame

0 commit comments

Comments
 (0)