aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2017-12-01 11:50:32 +0100
committermarcinzelent <zelent.marcin@gmail.com>2017-12-01 11:50:32 +0100
commit316d811f8d2624317083052513b1fdfa10c1e490 (patch)
treef51c56570836eaa549936e06d4a6167cdb50190e /src/AppBundle/Controller
parent8b8639740c08633728f0d9dd778ac022e43f7e1b (diff)
Almost there...
Diffstat (limited to 'src/AppBundle/Controller')
-rw-r--r--src/AppBundle/Controller/HomeController.php5
-rw-r--r--src/AppBundle/Controller/NewDataController.php7
2 files changed, 5 insertions, 7 deletions
diff --git a/src/AppBundle/Controller/HomeController.php b/src/AppBundle/Controller/HomeController.php
index ca2043e..70bd323 100644
--- a/src/AppBundle/Controller/HomeController.php
+++ b/src/AppBundle/Controller/HomeController.php
@@ -11,6 +11,7 @@ namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use AppBundle\Utils\Aqi;
+use AppBundle\Utils\EmailSender;
class HomeController extends Controller
{
@@ -19,8 +20,10 @@ class HomeController extends Controller
*/
- public function numberAction(Aqi $aqi)
+ public function numberAction(Aqi $aqi, EmailSender $emailSender)
{
+ $emailSender->main();
+
$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]),
diff --git a/src/AppBundle/Controller/NewDataController.php b/src/AppBundle/Controller/NewDataController.php
index 8bfda68..ecb1be9 100644
--- a/src/AppBundle/Controller/NewDataController.php
+++ b/src/AppBundle/Controller/NewDataController.php
@@ -11,8 +11,6 @@ namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use AppBundle\Utils\Aqi;
-use AppBundle\Utils\EmailSender;
class NewDataController extends Controller
{
@@ -20,7 +18,7 @@ class NewDataController extends Controller
* @Route("/latest")
*/
- public function getLatestData(Aqi $aqi, EmailSender $emailSender)
+ public function getLatestData()
{
// Get cURL resource
$curl = curl_init();
@@ -39,9 +37,6 @@ class NewDataController extends Controller
$response = new Response($data);
$response->headers->set('Content-Type', 'application/json');
- $data = json_decode($resp, true);
- if($aqi >= 151) $emailSender->sendEmail($data);
-
return $response;
}