Skip to content

Commit

Permalink
fix: remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
FrantisekMichalSebestyen committed Aug 24, 2023
1 parent 8eaecc9 commit 762bbea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
10 changes: 1 addition & 9 deletions app/Http/Controllers/NewCatalogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ class NewCatalogController extends Controller
*/
public function index()
{
$yearLimits = Cache::remember(
'items.year-limits',
now()->addHours(1),
fn() => Item::getYearLimits()
);

return view('frontend.catalog-new.index-new', [
'yearLimits' => $yearLimits,
]);
return view('frontend.catalog-new.index-new');
}
}
25 changes: 0 additions & 25 deletions app/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,31 +144,6 @@ public function getCitation()
return $this->getTitleWithAuthors() . ', ' . $this->getDatingFormated() . ', ' . $this->gallery . ', ' . $this->getUrl();
}

// Get limits from elastic, because date_earliest and date_latest
// are not indexed in DB
public static function getYearLimits()
{
$searchResult = self::searchQuery(Query::matchAll())
->size(false)
->aggregate('min', [
'min' => [
'field' => 'date_earliest',
],
])
->aggregate('max', [
'max' => [
'field' => 'date_latest',
],
])
->execute()
->raw();

return [
'min' => $searchResult['aggregations']['min']['value'],
'max' => $searchResult['aggregations']['max']['value'],
];
}

public static function loadValidatorMetadata(ClassMetadata $metadata) {
$metadata->addGetterConstraint('images', new Valid());
}
Expand Down

0 comments on commit 762bbea

Please sign in to comment.