MAPG-235 added time limit type field to the challenge
This commit is contained in:
parent
c085a5a1ca
commit
2a1b51b014
@ -2,6 +2,7 @@ CREATE TABLE `challenges` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`token` int(10) unsigned NOT NULL,
|
||||
`time_limit` int(10) unsigned,
|
||||
`time_limit_type` enum('game', 'round') NOT NULL DEFAULT 'game',
|
||||
`no_move` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`no_pan` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`no_zoom` tinyint(1) NOT NULL DEFAULT 0,
|
||||
|
@ -6,7 +6,7 @@ class Challenge extends Model
|
||||
{
|
||||
protected static string $table = 'challenges';
|
||||
|
||||
protected static array $fields = ['token', 'time_limit', 'no_move', 'no_pan', 'no_zoom', 'created'];
|
||||
protected static array $fields = ['token', 'time_limit', 'time_limit_type', 'no_move', 'no_pan', 'no_zoom', 'created'];
|
||||
|
||||
protected static array $relations = [];
|
||||
|
||||
@ -14,6 +14,10 @@ class Challenge extends Model
|
||||
|
||||
private ?int $timeLimit = null;
|
||||
|
||||
private static array $timeLimitTypes = ['game', 'round'];
|
||||
|
||||
private string $timeLimitType = 'game';
|
||||
|
||||
private bool $noMove = false;
|
||||
|
||||
private bool $noPan = false;
|
||||
@ -34,6 +38,13 @@ class Challenge extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function setTimeLimitType(string $timeLimitType): void
|
||||
{
|
||||
if (in_array($timeLimitType, self::$timeLimitTypes)) {
|
||||
$this->timeLimitType = $timeLimitType;
|
||||
}
|
||||
}
|
||||
|
||||
public function setNoMove(bool $noMove): void
|
||||
{
|
||||
$this->$noMove = $noMove;
|
||||
@ -69,6 +80,11 @@ class Challenge extends Model
|
||||
return $this->timeLimit;
|
||||
}
|
||||
|
||||
public function getTimeLimitType(): string
|
||||
{
|
||||
return $this->timeLimitType;
|
||||
}
|
||||
|
||||
public function getNoMove(): bool
|
||||
{
|
||||
return $this->noMove;
|
||||
|
Loading…
Reference in New Issue
Block a user