improve validation
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good Details

This commit is contained in:
Daniel Guzman 2024-05-26 12:33:13 +02:00
parent fe3ebf9dc5
commit 93df0e8ffd
2 changed files with 3 additions and 3 deletions

View File

@ -200,15 +200,15 @@ class LeagueDto
{ {
$this->validationErrors[] = 'Los puntos por partido ganado deben ser superiores a los puntos por empate y por perdida.'; $this->validationErrors[] = 'Los puntos por partido ganado deben ser superiores a los puntos por empate y por perdida.';
} }
if (($this->pointsPerDraw > $this->pointsPerWin)) if (isset($this->pointsPerDraw, $this->pointsPerWin) && ($this->pointsPerDraw > $this->pointsPerWin))
{ {
$this->validationErrors[] = 'Los puntos por empate deben ser inferiores a los puntos por partido ganado.'; $this->validationErrors[] = 'Los puntos por empate deben ser inferiores a los puntos por partido ganado.';
} }
if (($this->pointsPerDraw < $this->pointsPerLoss)) if (isset($this->pointsPerDraw, $this->pointsPerLoss) && ($this->pointsPerDraw < $this->pointsPerLoss))
{ {
$this->validationErrors[] = 'Los puntos por empate deben ser superiores a los puntos por partido perdido.'; $this->validationErrors[] = 'Los puntos por empate deben ser superiores a los puntos por partido perdido.';
} }
if ($this->pointsPerWin + $this->pointsPerDraw + $this->pointsPerLoss > 20) if (isset($this->pointsPerDraw, $this->pointsPerWin, $this->pointsPerLoss) && ($this->pointsPerWin + $this->pointsPerDraw + $this->pointsPerLoss > 20))
{ {
$this->validationErrors[] = 'La suma de los puntos por partidos ganados, perdidos y empatados no puede ser superior a 20.'; $this->validationErrors[] = 'La suma de los puntos por partidos ganados, perdidos y empatados no puede ser superior a 20.';
} }

Binary file not shown.