Add points as very first tiebreak

This commit is contained in:
Jeroen De Meerleer 2019-09-25 19:47:28 +02:00
parent 3ea12b0377
commit 627e9a4263
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

@ -477,6 +477,7 @@ class Swar4 implements ReaderInterface
} }
fclose($swshandle); fclose($swshandle);
$this->getTournament()->pairingsToRounds(); $this->getTournament()->pairingsToRounds();
$this->addTiebreaks();
return $this; return $this;
} }
@ -619,4 +620,24 @@ class Swar4 implements ReaderInterface
return DateTime::createFromFormat('Ymd', $string); return DateTime::createFromFormat('Ymd', $string);
} }
} }
/**
* @return $this
*/
private function addTiebreaks(): Swar4
{
switch ($this->getTournament()->getSystem()) {
case TournamentSystem::American:
$firstElement = new Tiebreak(Tiebreak::American);
break;
case TournamentSystem::Closed:
case TournamentSystem::Swiss:
default:
$firstElement = new Tiebreak(Tiebreak::Points);
}
$tiebreaks = $this->getTournament()->getTiebreaks();
array_unshift($tiebreaks, $firstElement);
$this->getTournament()->setTiebreaks($tiebreaks);
return $this;
}
} }