/**
  * @param Summit $s
  * @return array
  */
 protected function createSummitJSON(Summit $s)
 {
     $page = SummitPage::get()->filter('SummitID', $s->ID)->first();
     $image = null;
     if ($page) {
         $image = $page->SummitImage()->Image();
     }
     return ['id' => $s->ID, 'title' => $s->Title, 'dates' => $s->getSummitDateRange(), 'videoCount' => PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true, 'PresentationID' => $s->Presentations()->column('ID')])->count(), 'imageURL' => $image && $image->exists() && Director::fileExists($image->Filename) ? $image->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg'];
 }
 /**
  * @param Summit $s
  * @return array
  */
 protected function createSummitJSON(Summit $s)
 {
     $page = SummitPage::get()->filter('SummitID', $s->ID)->first();
     $image = null;
     if ($page) {
         $image = $page->SummitImage()->Image();
     }
     $tracks = array_map(function ($t) {
         return ['id' => $t->ID, 'slug' => $t->Slug, 'title' => $t->Title, 'has_videos' => 0];
     }, $s->Categories()->toArray());
     $videos = PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true])->sort('DateUploaded', 'DESC')->innerJoin('Presentation', 'Presentation.ID = PresentationMaterial.PresentationID')->innerJoin('SummitEvent', 'SummitEvent.ID = PresentationMaterial.PresentationID')->filter('SummitEvent.SummitID', $s->ID);
     $videos_groupedby_track = GroupedList::create($videos)->groupBy('Track');
     foreach ($tracks as &$track) {
         if (array_key_exists($track['title'], $videos_groupedby_track)) {
             $track['has_videos'] = 1;
         }
     }
     return ['id' => $s->ID, 'title' => $s->Title, 'dates' => $s->getSummitDateRange(), 'videoCount' => PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true, 'PresentationID' => $s->Presentations()->column('ID')])->count(), 'imageURL' => $image && $image->exists() && Director::fileExists($image->Filename) ? $image->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg', 'slug' => $s->Slug, 'tracks' => $tracks];
 }