Automatically fix invalid pairing dates on load (based on contained groupings)

This commit is contained in:
Dean Herbert 2018-12-14 18:11:04 +09:00
parent f083b18663
commit 8907ce3f63
1 changed files with 6 additions and 1 deletions

View File

@ -109,7 +109,12 @@ private void load(Storage storage, FrameworkConfigManager frameworkConfig)
foreach (var id in group.Pairings)
{
var found = Ladder.Pairings.FirstOrDefault(p => p.ID == id);
if (found != null) found.Grouping.Value = group;
if (found != null)
{
found.Grouping.Value = group;
if (group.StartDate.Value > found.Date.Value)
found.Date.Value = group.StartDate.Value;
}
}
Ladder.CurrentMatch.Value = Ladder.Pairings.FirstOrDefault(p => p.Current.Value);