diff --git a/components/match2/commons/match_group_display_helper.lua b/components/match2/commons/match_group_display_helper.lua index d32dd6dac2d..06a4f9ea59d 100644 --- a/components/match2/commons/match_group_display_helper.lua +++ b/components/match2/commons/match_group_display_helper.lua @@ -109,7 +109,8 @@ function DisplayHelper.MatchCountdownBlock(match) local stream = Table.merge(match.stream, { date = dateString, - finished = match.finished and 'true' or nil, + finished = match.finished, + rawdatetime = match.status == 'postponed', }) return mw.html.create('div'):addClass('match-countdown-block') :css('text-align', 'center') diff --git a/components/match2/commons/match_group_input_util.lua b/components/match2/commons/match_group_input_util.lua index 3ca00f24a81..3536fbc232c 100644 --- a/components/match2/commons/match_group_input_util.lua +++ b/components/match2/commons/match_group_input_util.lua @@ -80,6 +80,7 @@ MatchGroupInputUtil.STATUS.SCORE = 'S' MatchGroupInputUtil.MATCH_STATUS = { NOT_PLAYED = 'notplayed', + POSTPONED = 'postponed', } MatchGroupInputUtil.SCORE_NOT_PLAYED = -1 @@ -605,12 +606,21 @@ function MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) or (type(finishedInput) == 'string' and MatchGroupInputUtil.isNotPlayedInput(finishedInput)) end +---@param winnerInput integer|string|nil +---@param finishedInput string? +---@return boolean +function MatchGroupInputUtil.isPostponed(winnerInput, finishedInput) + return winnerInput == 'postponed' or finishedInput == 'postponed' +end + ---@param winnerInput integer|string|nil ---@param finishedInput string? ---@return string? #Match Status function MatchGroupInputUtil.getMatchStatus(winnerInput, finishedInput) if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) then return MatchGroupInputUtil.MATCH_STATUS.NOT_PLAYED + elseif MatchGroupInputUtil.isPostponed(winnerInput, finishedInput) then + return MatchGroupInputUtil.MATCH_STATUS.POSTPONED end end @@ -816,6 +826,8 @@ end function MatchGroupInputUtil.matchIsFinished(match, maps, opponents) if MatchGroupInputUtil.isNotPlayed(match.winner, match.finished) then return true + elseif MatchGroupInputUtil.isPostponed(match.winner, match.finished) then + return false end local finished = Logic.readBoolOrNil(match.finished) @@ -1161,6 +1173,9 @@ function MatchGroupInputUtil.standardProcessMatch(match, Parser, FfaParser, mapP Array.forEach(opponents, function(opponent, opponentIndex) opponent.placement = MatchGroupInputUtil.placementFromWinner(match.status, match.winner, opponentIndex) end) + elseif MatchGroupInputUtil.isPostponed(matchInput.winner, matchInput.finished) then + match.status = MatchGroupInputUtil.getMatchStatus(matchInput.winner, matchInput.finished) + match.dateexact = false end match.mode = Parser.getMode and Parser.getMode(opponents) @@ -1380,6 +1395,9 @@ function MatchGroupInputUtil.standardProcessFfaMatch(match, Parser, mapProps) match.winner = Parser.getMatchWinner and Parser.getMatchWinner(match.status, winnerInput, opponents) or MatchGroupInputUtil.getWinner(match.status, winnerInput, opponents) + elseif MatchGroupInputUtil.isPostponed(winnerInput, finishedInput) then + match.status = MatchGroupInputUtil.getMatchStatus(winnerInput, finishedInput) + match.dateexact = false end match.mode = Parser.getMode and Parser.getMode(opponents) diff --git a/components/match2/wikis/counterstrike/match_group_input_custom.lua b/components/match2/wikis/counterstrike/match_group_input_custom.lua index 04638b738b5..666a55957b1 100644 --- a/components/match2/wikis/counterstrike/match_group_input_custom.lua +++ b/components/match2/wikis/counterstrike/match_group_input_custom.lua @@ -51,7 +51,8 @@ function CustomMatchGroupInput.processMatch(match, options) match.finished = finishedInput local processedMatch = MatchGroupInputUtil.standardProcessMatch(match, MatchFunctions, FfaMatchFunctions) - processedMatch.extradata.status = match.status == MatchGroupInputUtil.MATCH_STATUS.NOT_PLAYED and finishedInput or nil + processedMatch.extradata.status = match.status == MatchGroupInputUtil.MATCH_STATUS.NOT_PLAYED + and finishedInput or match.status return processedMatch end