Skip to content

Commit

Permalink
Remove un-needed sql query from get software assets
Browse files Browse the repository at this point in the history
  • Loading branch information
turtle0x1 committed Sep 17, 2024
1 parent 346758b commit 6541b33
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ public function get(\DateTimeImmutable $date = null)
if ($date == null) {
$date = new \DateTimeImmutable();
}
$snapshot = $this->fetchSoftwareAssetSnapshots->fetchForDate($date);
$snapshotHeaders = $this->fetchSoftwareAssetSnapshots->fetchLastSevenHeaders();

$snapshot = $this->fetchSoftwareAssetSnapshots->fetchForDate($date);

$output = [
"date" => $date->format("Y-m-d"),
Expand Down Expand Up @@ -85,7 +84,7 @@ public function get(\DateTimeImmutable $date = null)
if (!isset($output["packages"][$packageKey])) {
$output["packages"][$packageKey] = [
"name" => $package["name"],
"totalInstalls"=>0,
"totalInstalls" => 0,
"versions" => []
];
}
Expand All @@ -110,7 +109,7 @@ public function get(\DateTimeImmutable $date = null)

usort($output["packages"], [$this, "sortInstalls"]);

$output["packages"] = array_slice($output["packages"], 0 , 20);
$output["packages"] = array_slice($output["packages"], 0, 20);

return $output;
}
Expand Down

0 comments on commit 6541b33

Please sign in to comment.