Fix commit

This commit is contained in:
William 2022-02-16 11:59:47 +01:00
parent 57be7a931a
commit b319dd23fd

View File

@ -61,9 +61,8 @@ class Teamtable
$sth = $this->dbh->prepare( $sth = $this->dbh->prepare(
'INSERT INTO lagtabell (LagNavn, Bedrift, Kortnummer, Lagleder, Telefon, Deltagere, Runder) VALUES (?, ?, ?, ?, ?, ?, ?)' 'INSERT INTO lagtabell (LagNavn, Bedrift, Kortnummer, Lagleder, Telefon, Deltagere, Runder) VALUES (?, ?, ?, ?, ?, ?, ?)'
); );
$template = $this->emptyTeamTemplate; $template = $this->emptyTeamTemplate;
$template = [ $sth->execute([
$template['LagNavn'], $template['LagNavn'],
$template['Bedrift'], $template['Bedrift'],
$template['Kortnummer'], $template['Kortnummer'],
@ -71,8 +70,7 @@ class Teamtable
$template['Telefon'], $template['Telefon'],
$template['Deltagere'], $template['Deltagere'],
$template['Runder'], $template['Runder'],
]; ]);
$sth->execute($template);
return $this->dbh->lastInsertId(); return $this->dbh->lastInsertId();
} }
@ -80,18 +78,12 @@ class Teamtable
public function isEqualEmptyTemplate(array $team): bool public function isEqualEmptyTemplate(array $team): bool
{ {
$template = $this->emptyTeamTemplate; $template = $this->emptyTeamTemplate;
$equal = FALSE; foreach ($template as $key => $value) {
foreach ($team as $key => $value) { if ((string)$team[$key] !== (string)$template[$key]) {
if (!isset($template[$key])) { return FALSE;
continue;
} }
if ($template[$key] !== $team[$key]) {
$equal = FALSE;
break;
}
$equal = TRUE;
} }
return $equal; return TRUE;
} }
// Return true if team exists, false if not // Return true if team exists, false if not