protected override void InnerCalculate(PlayerFixture 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 (PlayerMatch 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();
            }
        }
Example #2
0
 public Task <bool> AllMatchesProcessedWithResult()
 {
     return(Task.FromResult(this.Data.Matches.All(x => MatchStatus.IsProcessedWithResult(x.MatchStatusID))));
 }