Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/Turnierplan.Core/Tournament/Match.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,9 @@ internal Match(int id, int index, TeamSelectorBase teamSelectorA, TeamSelectorBa

public void SetOutcome(bool isCurrentlyPlaying, int scoreA, int scoreB, MatchOutcomeType outcomeType)
{
if (!isCurrentlyPlaying)
if (!isCurrentlyPlaying && IsDecidingMatch && scoreA == scoreB)
{
if (IsDecidingMatch && scoreA == scoreB)
{
throw new TurnierplanException("Deciding matches cannot end with a draw.");
}

if (outcomeType == MatchOutcomeType.AfterPenalties && scoreA == scoreB)
{
throw new TurnierplanException($"When outcome type is '{nameof(MatchOutcomeType.AfterPenalties)}', the match may not be a draw.");
}
throw new TurnierplanException("Deciding matches cannot end with a draw.");
}

IsCurrentlyPlaying = isCurrentlyPlaying;
Expand Down
Loading