Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #85 from dBucik/dev
Browse files Browse the repository at this point in the history
fix: 🐛 Fix parameters ordering and duplicate insert
  • Loading branch information
dBucik authored Sep 1, 2022
2 parents 94ef966 + ceef3ee commit 5289f8b
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions lib/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,6 @@ public function insertLoginFromFilter($request, $date)
$entities = $this->getEntities($request);
$userId = $this->getUserId($request);
$this->insertLogin($entities, $userId, $date);

$ids = [];
foreach (self::TABLE_SIDES as $side => $table) {
$tableId = self::TABLE_IDS[$table];
$ids[$tableId] = $this->getEntityDbIdFromEntityIdentifier($table, $entities[$side], $tableId);
}

if (!$this->writeLogin($date, $ids, $userId)) {
Logger::error(self::DEBUG_PREFIX . 'login record has not been inserted (data \'' . json_encode([
'user' => $userId,
'ids' => $ids,
'date' => $date,
]) . '\'.');
}
}

public function insertLoginFromApi($data, DateTime $date)
Expand Down Expand Up @@ -407,7 +393,7 @@ private function getEntities($request): array
return $this->prepareEntitiesStructure($idpIdentifier, $idpName, $spIdentifier, $spName);
}

private function prepareEntitiesStructure($idpIdentifier, $idpName, $spName, $spIdentifier): array
private function prepareEntitiesStructure($idpIdentifier, $idpName, $spIdentifier, $spName): array
{
$entities = [
Config::MODE_IDP => [],
Expand Down

0 comments on commit 5289f8b

Please sign in to comment.