public Challenge( ChallengeId id, ChallengeName name, Game game, BestOf bestOf, Entries entries, ChallengeTimeline timeline, IScoring scoring ) { this.SetEntityId(id); Name = name; Game = game; BestOf = bestOf; Entries = entries; Timeline = timeline; Scoring = scoring; this.AddDomainEvent(new ChallengeCreatedDomainEvent(this)); }
internal ParticipantScore(Participant participant, BestOf bestOf) : base(participant.Matches.OrderByDescending(match => match.Score).Take(bestOf).Average(match => match.Score.ToDecimal())) { }
public Score?ComputeScore(BestOf bestOf) { return(Matches.Count >= bestOf ? new ParticipantScore(this, bestOf) : null); }