Merge branch 'master' into tournament-always-use-production-endpoint

This commit is contained in:
Bartłomiej Dach 2023-01-17 19:46:48 +01:00 committed by GitHub
commit bb4d520500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -113,7 +113,7 @@ private void reload()
new LabelledDropdown<RulesetInfo>
{
Label = "Ruleset",
Description = "Decides what stats are displayed and which ranks are retrieved for players.",
Description = "Decides what stats are displayed and which ranks are retrieved for players. This requires a restart to reload data for an existing bracket.",
Items = rulesets.AvailableRulesets,
Current = LadderInfo.Ruleset,
},

View File

@ -165,9 +165,21 @@ private void readBracket()
addedInfo |= addSeedingBeatmaps();
if (addedInfo)
SaveChanges();
saveChanges();
ladder.CurrentMatch.Value = ladder.Matches.FirstOrDefault(p => p.Current.Value);
ladder.Ruleset.BindValueChanged(r =>
{
// Refetch player rank data on next startup as the ruleset has changed.
foreach (var team in ladder.Teams)
{
foreach (var player in team.Players)
player.Rank = null;
}
SaveChanges();
});
}
catch (Exception e)
{
@ -315,6 +327,11 @@ public void SaveChanges()
return;
}
saveChanges();
}
private void saveChanges()
{
foreach (var r in ladder.Rounds)
r.Matches = ladder.Matches.Where(p => p.Round.Value == r).Select(p => p.ID).ToList();