protected override Task InnerCalculate(TeamFixture fixture) { if (fixture.Matches.Count == fixture.Legs && fixture.Matches.All(x => x.MatchStatusID.IsProcessedWithResult())) { var match = fixture.Matches.SingleOrDefault(); if (match != null) { this.CalculateMatch(fixture, match); fixture.SetComplete(); } else { fixture.SetIncomplete(); } } else { fixture.SetIncomplete(); } return(Task.CompletedTask); }
protected override Task InnerCalculate(TeamFixture fixture) { if (fixture.Matches.Count == fixture.Legs && fixture.Matches.All(x => MatchStatus.IsProcessedWithResult(x.MatchStatusID))) { fixture.Entrant1GameScore = 0; fixture.Entrant1ChalkScore = 0; fixture.Entrant1Walkover = true; fixture.Entrant2GameScore = 0; fixture.Entrant2ChalkScore = 0; fixture.Entrant2Walkover = true; foreach (TeamMatch playerMatch in fixture.Matches) { short gameScore; short chalkScore; short?bonusScore; bool? walkover; playerMatch.GetScoresByEntrantID(fixture.Entrant1.ID, out gameScore, out chalkScore, out bonusScore, out walkover); fixture.Entrant1GameScore += gameScore; fixture.Entrant1ChalkScore += chalkScore; if (bonusScore.HasValue) { if (!fixture.Entrant1BonusScore.HasValue) { fixture.Entrant1BonusScore = 0; } fixture.Entrant1BonusScore += bonusScore.Value; } if (walkover.HasValue) { fixture.Entrant1Walkover &= walkover.Value; } playerMatch.GetScoresByEntrantID(fixture.Entrant2.ID, out gameScore, out chalkScore, out bonusScore, out walkover); fixture.Entrant2GameScore += gameScore; fixture.Entrant2ChalkScore += chalkScore; if (bonusScore.HasValue) { if (!fixture.Entrant2BonusScore.HasValue) { fixture.Entrant2BonusScore = 0; } fixture.Entrant2BonusScore += bonusScore.Value; } if (walkover.HasValue) { fixture.Entrant2Walkover &= walkover.Value; } } this.CalculateResultType(fixture); fixture.SetComplete(); } else { fixture.SetIncomplete(); } return(Task.CompletedTask); }