Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(match2): tournament_status is not working #4881

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/match2/commons/match_group_input_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ local NOT_PLAYED_INPUTS = {
'np',
'canceled',
'cancelled',
'postponed',
hjpalpha marked this conversation as resolved.
Show resolved Hide resolved
}

MatchGroupInputUtil.DEFAULT_ALLOWED_VETOES = {
Expand Down
16 changes: 6 additions & 10 deletions components/match2/wikis/counterstrike/match_group_input_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ local CustomMatchGroupInput = {}
---@param options table?
---@return table
function CustomMatchGroupInput.processMatch(match, options)
match.status = Logic.emptyOr(match.status, Variables.varDefault('tournament_status'), match.finished)
if (not Logic.readBool(match.finished)) and Logic.isNotEmpty(match.status) then
match.finished = match.status
end

local finishedInput = match.finished --[[@as string?]]
Rathoz marked this conversation as resolved.
Show resolved Hide resolved
local winnerInput = match.winner --[[@as string?]]

Expand Down Expand Up @@ -76,7 +81,6 @@ function CustomMatchGroupInput.processMatch(match, options)

match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team'))
match.publishertier = Logic.emptyOr(match.publishertier, Variables.varDefault('tournament_valve_tier'))
match.status = Logic.emptyOr(match.status, Variables.varDefault('tournament_status'))
Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match))

match.stream = Streams.processStreams(match)
Expand Down Expand Up @@ -198,14 +202,6 @@ function MatchFunctions.getLinks(match, maps)
end)
end

---@param match table
---@return string?
function MatchFunctions.getMatchStatus(match)
if match.resulttype == 'np' then
return Logic.emptyOr(match.status, Variables.varDefault('tournament_status'))
end
end

---@param name string?
---@param year string|osdate
---@return number
Expand Down Expand Up @@ -253,7 +249,7 @@ end
function MatchFunctions.getExtraData(match, opponents)
return {
mapveto = MatchGroupInputUtil.getMapVeto(match),
status = MatchFunctions.getMatchStatus(match),
status = match.resulttype == MatchGroupInputUtil.RESULT_TYPE.NOT_PLAYED and match.status or nil,
Rathoz marked this conversation as resolved.
Show resolved Hide resolved
overturned = Logic.isNotEmpty(match.overturned),
featured = MatchFunctions.isFeatured(match, opponents),
hidden = Logic.readBool(Variables.varDefault('match_hidden'))
Expand Down
Loading