1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 16:07:25 +08:00

Merge pull request #22939 from peppy/fix-tournament-round-edit-save-button

Fix tournament interface save button not usable after changing match progression/round
This commit is contained in:
Bartłomiej Dach 2023-03-23 22:15:27 +01:00 committed by GitHub
commit aa0677630f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -332,13 +332,6 @@ namespace osu.Game.Tournament
private void saveChanges()
{
foreach (var r in ladder.Rounds)
r.Matches = ladder.Matches.Where(p => p.Round.Value == r).Select(p => p.ID).ToList();
ladder.Progressions = ladder.Matches.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat(
ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
.ToList();
// Serialise before opening stream for writing, so if there's a failure it will leave the file in the previous state.
string serialisedLadder = GetSerialisedLadder();
@ -349,6 +342,13 @@ namespace osu.Game.Tournament
public string GetSerialisedLadder()
{
foreach (var r in ladder.Rounds)
r.Matches = ladder.Matches.Where(p => p.Round.Value == r).Select(p => p.ID).ToList();
ladder.Progressions = ladder.Matches.Where(p => p.Progression.Value != null).Select(p => new TournamentProgression(p.ID, p.Progression.Value.ID)).Concat(
ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
.ToList();
return JsonConvert.SerializeObject(ladder,
new JsonSerializerSettings
{