Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
ignore region for ranked2 seasons
Browse files Browse the repository at this point in the history
  • Loading branch information
aspriddell committed Dec 23, 2022
1 parent 0650e9f commit fbec41b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions DragonFruit.Six.Api/Seasonal/SeasonStatsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,24 @@ public static async Task<IReadOnlyCollection<SeasonalStats>> GetSeasonalStatsRec

if (otherSeasons.Any())
{
var platformRequests = accounts.GroupBy(x => x.Platform).Select(x => new SeasonalStatsRecordRequest(x, otherSeasons, boards.Value));
requests.AddRange(platformRequests);
}

var seasonalStatsRequests = requests.Select(x =>
{
if (regions.HasValue)
var platformRequests = accounts.GroupBy(x => x.Platform).Select(x =>
{
x.Regions = regions.Value;
}
var request = new SeasonalStatsRecordRequest(x, otherSeasons, boards.Value);

if (regions.HasValue)
{
request.Regions = regions.Value;
}

return client.PerformAsync<JObject>(x, token);
});
return request;
});

requests.AddRange(platformRequests);
}

var seasonalStatsRequests = requests.Select(x => client.PerformAsync<JObject>(x, token));
var seasonalStatsResponses = await Task.WhenAll(seasonalStatsRequests).ConfigureAwait(false);

return seasonalStatsResponses.SelectMany(x => x.SelectTokens("$..players_skill_records[*]")).Select(x => x.ToObject<SeasonalStats>()).ToList();
}
}
Expand Down

0 comments on commit fbec41b

Please sign in to comment.