Commit e9a3a875 authored by Andrea Ruggiero's avatar Andrea Ruggiero
Browse files

Improve performance

parent cf9ec66e
Pipeline #1564 failed with stage
in 0 seconds
......@@ -33,7 +33,7 @@ class EventController extends Controller
if (isset($skip[$event->event_id])) continue;
$places = [];
foreach ($eventRepository->getSimilarEvents($event) as $e) {
$skip[$e->event_id] = false;
$skip[$e["event_id"]] = false;
if ($event->place_id === null) {
$places = array_map(function($place) {
return [
......@@ -46,7 +46,7 @@ class EventController extends Controller
}, $placeRepository->all());
break;
} else {
$place = $placeRepository->getById($e->place_id);
$place = $placeRepository->getById($e["place_id"]);
$places[] = [
"place" => $place->name,
"capacity" => $place->capacity,
......
......@@ -27,7 +27,7 @@ class EventRepository extends BaseRepository
$this->cache[$event->event_id] = $this->db()->where('title', $event->title)->where('date', $event->date)->where('start', $event->start)->where('end', $event->end)->select('place_id', 'event_id')->get();
file_put_contents('cache.json', json_encode($this->cache));
}
return (object) $this->cache[$event->event_id];
return $this->cache[$event->event_id];
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment