From b319dd23fd597f8d96420201d677e1da0e466aca Mon Sep 17 00:00:00 2001 From: William Date: Wed, 16 Feb 2022 11:59:47 +0100 Subject: [PATCH] Fix commit --- app/model/Teamtable.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/model/Teamtable.php b/app/model/Teamtable.php index 741d15a..daefedc 100644 --- a/app/model/Teamtable.php +++ b/app/model/Teamtable.php @@ -61,9 +61,8 @@ class Teamtable $sth = $this->dbh->prepare( 'INSERT INTO lagtabell (LagNavn, Bedrift, Kortnummer, Lagleder, Telefon, Deltagere, Runder) VALUES (?, ?, ?, ?, ?, ?, ?)' ); - $template = $this->emptyTeamTemplate; - $template = [ + $sth->execute([ $template['LagNavn'], $template['Bedrift'], $template['Kortnummer'], @@ -71,8 +70,7 @@ class Teamtable $template['Telefon'], $template['Deltagere'], $template['Runder'], - ]; - $sth->execute($template); + ]); return $this->dbh->lastInsertId(); } @@ -80,18 +78,12 @@ class Teamtable public function isEqualEmptyTemplate(array $team): bool { $template = $this->emptyTeamTemplate; - $equal = FALSE; - foreach ($team as $key => $value) { - if (!isset($template[$key])) { - continue; + foreach ($template as $key => $value) { + if ((string)$team[$key] !== (string)$template[$key]) { + return FALSE; } - if ($template[$key] !== $team[$key]) { - $equal = FALSE; - break; - } - $equal = TRUE; } - return $equal; + return TRUE; } // Return true if team exists, false if not