Skip to content

Matches page queries aren't being handled correctly #348

@francislavoie

Description

@francislavoie

Repro steps:

  • Go to https://w3champions.com/matches
  • Choose a map (some active 1v1 map)
  • See the live games are correctly filtered by the map
  • Choose "Finished"
  • Notice the results contain all maps, not filtered by the one you picked

The problem seems to be with this endpoint:

[HttpGet("")]
public async Task<IActionResult> GetMatches(
int offset = 0,
int pageSize = 100,
GameMode gameMode = GameMode.Undefined,
int season = -1)
{
if (season < 0)
{
var lastSeason = await _matchRepository.LoadLastSeason();
season = lastSeason.Id;
}
if (pageSize > 100) pageSize = 100;
var matches = await _matchRepository.Load(season, gameMode, offset, pageSize);
var count = await _matchRepository.Count(season, gameMode);
return Ok(new { matches, count });
}

The frontend makes requests like https://website-backend.w3champions.com/api/matches?offset=0&gateway=20&pageSize=50&gameMode=1&map=2404091839ConcealedHill&season=20, i.e. &map=2404091839ConcealedHill but this param isn't being read at all by this API endpoint, so the data returned is for all maps instead.

The gateway query param isn't being read either, but that probably matters less.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions