From 1ab2b90b02705e206680b5428bf1fbaec6438132 Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Fri, 16 Mar 2018 17:53:32 +0100 Subject: Removed old files. --- .../Controller/TrainScheduleController.php | 110 --------------------- 1 file changed, 110 deletions(-) delete mode 100644 src/AppBundle/Controller/TrainScheduleController.php (limited to 'src/AppBundle/Controller/TrainScheduleController.php') diff --git a/src/AppBundle/Controller/TrainScheduleController.php b/src/AppBundle/Controller/TrainScheduleController.php deleted file mode 100644 index a6b517d..0000000 --- a/src/AppBundle/Controller/TrainScheduleController.php +++ /dev/null @@ -1,110 +0,0 @@ - time()) - { - $trains[$i]['direction'] = 0; - continue; - } - - foreach ($readings as $reading) { - if (abs($reading['TimeStamp'] - $trainTimeStamp) < abs($closest - $trainTimeStamp)) - $closest = $reading['TimeStamp']; - } - - $closestReading = $readings[0]; - foreach ($readings as $reading) - { - if($reading['TimeStamp'] == $closest) $closestReading = $reading; - } - $trains[$i]['direction'] = $this->getAqi($closestReading); - } - - $parametersToTwig = array("data" => $trains); - - return $this->render('default/TrainSchedule.html.twig', $parametersToTwig); - } - - private function getAqi(array $data) - { - $aqi = new Aqi(); - - $table = array( - 'Co' => array('breakpoints' => [0, 4.4, 4.5, 9.4, 9.5, 12.4, 12.5, 15.4, 15.5, 30.4, 30.5, 40.4, 40.5, 50.4], - 'aq' => [0, 50, 51, 100, 101, 150, 151, 200, 201, 300, 301, 400, 401, 500]), - 'So' => array('breakpoints' => [0.000, 0.034, 0.035, 0.144, 0.145, 0.224, 0.225, 0.304, 0.305, 0.604, 0.605, 0.804, 0.805, 1.004], - 'aq' => [0, 50, 51, 100, 101, 150, 151, 200, 201, 300, 301, 400, 401, 500]), - 'No' => array('breakpoints' => [0,0.05,0.08,0.10,0.15,0.20,0.25 ,0.31,0.65, 1.24, 1.25, 1.64, 1.65, 2.04], - 'aq' => [0 ,50 ,51 ,100 ,101 ,150 ,151,200,201, 300, 301, 400, 401, 500]) - ); - - $tableObj = json_decode(json_encode($table)); - - $arr = []; - $CO = is_nan($aqi->calculateAQI("Co", $data['Co'], $tableObj)) ? 0 : $aqi->calculateAQI("Co", $data['Co'], $tableObj); - $SO = is_nan($aqi->calculateAQI("So", $data['So'], $tableObj)) ? 0 : $aqi->calculateAQI("So", $data['So'], $tableObj); - $NO = is_nan($aqi->calculateAQI("No", $data['No'], $tableObj)) ? 0 : $aqi->calculateAQI("No", $data['No'], $tableObj); - - array_push($arr, $CO, $SO, $NO); - $max = max($arr); - - return $max; - } -} \ No newline at end of file -- cgit v1.2.3