MAPG-235 new challenge can be created and is prepared

This commit is contained in:
balazs committed 2021-05-12 13:51:06 +02:00
1 parent 99244e93d2
commit d7147b30d6
14 files changed
+289 -17

No files matched your search

+10 -8
View File
@@ -4,7 +4,7 @@ use DateTime;
class Challenge extends Model
{
protected static string $table = 'challenge';
protected static string $table = 'challenges';
protected static array $fields = ['token', 'timer_sec', 'no_move', 'no_pan', 'no_zoom', 'created'];
@@ -12,13 +12,13 @@ class Challenge extends Model
private int $token;
private int $timerSec;
private ?int $timerSec = null;
private bool $noMove;
private bool $noMove = false;
private bool $noPan;
private bool $noPan = false;
private bool $noZoom;
private bool $noZoom = false;
private DateTime $created;
@@ -27,9 +27,11 @@ class Challenge extends Model
$this->token = $token;
}
public function setTimerSec(int $timerSec): void
public function setTimerSec(?int $timerSec): void
{
$this->timerSec = $timerSec;
if(isset($timerSec)) {
$this->timerSec = $timerSec;
}
}
public function setNoMove(bool $noMove): void
@@ -62,7 +64,7 @@ class Challenge extends Model
return $this->token;
}
public function getTimerSec(): int
public function getTimerSec(): ?int
{
return $this->timerSec;
}
+8 -6
View File
@@ -16,13 +16,13 @@ class UserInChallenge extends Model
private ?int $challengeId = null;
private int $round;
private int $round = -1;
private int $score;
private int $score = 0;
private int $timeLeft;
private ?int $timeLeft = null;
private bool $isOwner;
private bool $isOwner = false;
public function setUser(User $user): void
{
@@ -54,9 +54,11 @@ class UserInChallenge extends Model
$this->score = $score;
}
public function setTimeLeft(int $timeLeft): void
public function setTimeLeft(?int $timeLeft): void
{
$this->timeLeft = $timeLeft;
if(isset($timeLeft)) {
$this->timeLeft = $timeLeft;
}
}
public function setIsOwner(bool $isOwner): void