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

[BUG] Fix the Map Winner Logic in event of BO3 Match (to avoid confusing the map score with the series score) #273

Open
Cherno-Beliy opened this issue Mar 7, 2025 · 0 comments

Comments

@Cherno-Beliy
Copy link

Cherno-Beliy commented Mar 7, 2025

In the current implementation in Utility.cs, the map result event is created as follows:

var mapResultEvent = new MapResultEvent
{
    MatchId = liveMatchId,
    MapNumber = currentMapNumber,
    Winner = new Winner(
        t1score > t2score && reverseTeamSides["CT"] == matchzyTeam1 ? "3" : "2",
        team1SeriesScore > team2SeriesScore ? "team1" : "team2"),
    StatsTeam1 = new MatchZyStatsTeam(matchzyTeam1.id, matchzyTeam1.teamName, team1SeriesScore, t1score, 0, 0, new List<StatsPlayer>()),
    StatsTeam2 = new MatchZyStatsTeam(matchzyTeam2.id, matchzyTeam2.teamName, team2SeriesScore, t2score, 0, 0, new List<StatsPlayer>())
};

Issue:

The logic for determining the winning team erroneously compares the series score (team1SeriesScore vs. team2SeriesScore) instead of the current map score (t1score vs. t2score). This leads to situations where, for example, in Map 2 — even when the map score is 9:7 in favor of team1 — the winner is determined based on the series score (where both team1SeriesScore and team2SeriesScore are 1, causing the condition to select team2).

Examples of the incorrect event (map2) received:
Map 1:

{
  "event": "map_result",
  "team1": {
    "id": "",
    "name": "Die Right Now",
    "score": 4,
    "players": [],
    "score_t": 0,
    "score_ct": 0,
    "series_score": 0
  },
  "team2": {
    "id": "",
    "name": "losers",
    "score": 9,
    "players": [],
    "score_t": 0,
    "score_ct": 0,
    "series_score": 1
  },
  "winner": {
    "side": "2",
    "team": "team2"
  },
  "matchid": 155,
  "map_number": 0
}

Map 2:

{
  "event": "map_result",
  "team1": {
    "id": "",
    "name": "Die Right Now",
    "score": 9,
    "players": [],
    "score_t": 0,
    "score_ct": 0,
    "series_score": 1
  },
  "team2": {
    "id": "",
    "name": "losers",
    "score": 7,
    "players": [],
    "score_t": 0,
    "score_ct": 0,
    "series_score": 1
  },
  "winner": {
    "side": "3",
    "team": "team2"
  },
  "matchid": 155,
  "map_number": 1
}

Map 3:

{
  "event": "map_result",
  "team1": {
    "id": "",
    "name": "Die Right Now",
    "score": 4,
    "players": [],
    "score_t": 0,
    "score_ct": 0,
    "series_score": 1
  },
  "team2": {
    "id": "",
    "name": "losers",
    "score": 9,
    "players": [],
    "score_t": 0,
    "score_ct": 0,
    "series_score": 2
  },
  "winner": {
    "side": "2",
    "team": "team2"
  },
  "matchid": 155,
  "map_number": 2
}

Solution:

Modify the code so that the winner is determined by comparing the current map score (t1score and t2score) instead of the series score. The corrected code should be:

var mapResultEvent = new MapResultEvent
{
    MatchId = liveMatchId,
    MapNumber = currentMapNumber,
    Winner = new Winner(
        t1score > t2score && reverseTeamSides["CT"] == matchzyTeam1 ? "3" : "2",
        t1score > t2score ? "team1" : "team2"),
    StatsTeam1 = new MatchZyStatsTeam(matchzyTeam1.id, matchzyTeam1.teamName, team1SeriesScore, t1score, 0, 0, new List<StatsPlayer>()),
    StatsTeam2 = new MatchZyStatsTeam(matchzyTeam2.id, matchzyTeam2.teamName, team2SeriesScore, t2score, 0, 0, new List<StatsPlayer>())
};

With this change, the winner of the map will be correctly determined based on the map’s own score (t1score and t2score), eliminating the confusion between the result of an individual map and the overall series score.
A little more about this problem - https://discord.com/channels/1169549878490304574/1169551809237491762/1347209089406734478

@Cherno-Beliy Cherno-Beliy changed the title [BUG] Fix the Map Winner Logic in BO3 (to avoid confusing the map score with the series score) [BUG] Fix the Map Winner Logic in event of BO3 Match (to avoid confusing the map score with the series score) Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant