/**
  * @return mixed
  */
 public function renderRecords(Request $Request)
 {
     $title = 'Nueva Mavericks';
     if ($Request->get('grade')) {
         $Grade = new Grade($Request->get('grade'));
         $title = $Grade->getGradeText();
         $records = $this->RecordsService->getSchoolRecordsByGrade($Grade);
     } else {
         $records = $this->RecordsService->getSchoolRecords();
     }
     return $this->App['twig']->render('Track/records.twig', array('title' => $title, 'eventRecords' => $records));
 }
 /**
  * @param Grade $Grade
  * @return array
  */
 public function getSchoolRecordsByGrade(Grade $Grade)
 {
     $events = $this->TrackSQL->getEventsWithResults();
     $individualEvents = array();
     foreach ($events as $event) {
         if ($event['raceType'] == 'relay') {
             continue;
         }
         $records = $this->TrackSQL->getTopeEventRecordsByGrade($event['trackEventTypeId'], $event['eventGender'], $Grade->getGrade(), self::MAX_RECORDS);
         if (empty($records)) {
             continue;
         }
         $event['records'] = $this->formatIndividualRecords($records, $event['eventType']);
         $individualEvents[] = $event;
     }
     return $individualEvents;
 }