aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.idea/workspace.xml222
-rw-r--r--app/Resources/views/default/index.html.twig2
-rw-r--r--app/config/services.yml3
-rw-r--r--src/AppBundle/Controller/HomeController.php30
-rw-r--r--src/AppBundle/Utils/Aqi.php43
6 files changed, 230 insertions, 71 deletions
diff --git a/.gitignore b/.gitignore
index 2f75ca1..1f191e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
+.idea
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 522e0a3..a83eafe 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,9 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c02a68ca-4895-49ef-94e1-572ab8cf87ba" name="Default" comment="">
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/Resources/views/default/index.html.twig" afterPath="$PROJECT_DIR$/app/Resources/views/default/index.html.twig" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/web/js/realtime.js" afterPath="$PROJECT_DIR$/web/js/realtime.js" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/config/services.yml" afterPath="$PROJECT_DIR$/app/config/services.yml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php" afterPath="$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@@ -19,36 +21,45 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
- <file leaf-file-name="HomeController.php" pinned="false" current-in-tab="false">
+ <file leaf-file-name="HomeController.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php">
<provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="338">
- <caret line="34" column="80" lean-forward="false" selection-start-line="34" selection-start-column="80" selection-end-line="34" selection-end-column="80" />
+ <state relative-caret-position="302">
+ <caret line="56" column="113" lean-forward="false" selection-start-line="56" selection-start-column="113" selection-end-line="56" selection-end-column="113" />
<folding>
<element signature="e#6#87#0#PHP" expanded="true" />
<element signature="e#122#181#0#PHP" expanded="true" />
- <marker date="1511787169553" expanded="true" signature="328:1132" ph="{...}" />
- <marker date="1511787169553" expanded="true" signature="418:528" ph="{...}" />
+ <element signature="e#2399#2424#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="index.html.twig" pinned="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/Resources/views/default/index.html.twig">
+ <file leaf-file-name="Aqi.php" pinned="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/AppBundle/Utils/Aqi.php">
<provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="360">
- <caret line="20" column="70" lean-forward="false" selection-start-line="20" selection-start-column="70" selection-end-line="20" selection-end-column="70" />
+ <state relative-caret-position="90">
+ <caret line="12" column="11" lean-forward="false" selection-start-line="12" selection-start-column="11" selection-end-line="12" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="realtime.js" pinned="false" current-in-tab="true">
+ <file leaf-file-name="realtime.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/web/js/realtime.js">
<provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="180">
- <caret line="91" column="25" lean-forward="false" selection-start-line="91" selection-start-column="25" selection-end-line="91" selection-end-column="25" />
+ <state relative-caret-position="684">
+ <caret line="71" column="29" lean-forward="false" selection-start-line="71" selection-start-column="29" selection-end-line="71" selection-end-column="29" />
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="index.html.twig" pinned="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/Resources/views/default/index.html.twig">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="342">
+ <caret line="19" column="21" lean-forward="false" selection-start-line="19" selection-start-column="21" selection-end-line="19" selection-end-column="21" />
<folding />
</state>
</provider>
@@ -83,12 +94,18 @@
<option value="$PROJECT_DIR$/composer.json" />
<option value="$PROJECT_DIR$/app/AppKernel.php" />
<option value="$PROJECT_DIR$/src/AppBundle/View/Home.php" />
- <option value="$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php" />
<option value="$PROJECT_DIR$/bin/console" />
<option value="$PROJECT_DIR$/src/AppBundle/Controller/NewData.php" />
<option value="$PROJECT_DIR$/src/AppBundle/Controller/NewDataController.php" />
- <option value="$PROJECT_DIR$/app/Resources/views/default/index.html.twig" />
+ <option value="$PROJECT_DIR$/src/AppBundle/Constants/gasTable.php" />
+ <option value="$PROJECT_DIR$/src/AppBundle/Controller/Util/Aqi.php" />
+ <option value="$PROJECT_DIR$/src/AppBundle/Util/Aqi.php" />
+ <option value="$PROJECT_DIR$/app/config/services.yml" />
<option value="$PROJECT_DIR$/web/js/realtime.js" />
+ <option value="$PROJECT_DIR$/app/Resources/views/default/index.html.twig" />
+ <option value="$PROJECT_DIR$/src/AppBundle/Utils/Aqi.php" />
+ <option value="$PROJECT_DIR$/.gitignore" />
+ <option value="$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php" />
</list>
</option>
</component>
@@ -169,6 +186,42 @@
<item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
<item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
+ <path>
+ <item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
+ <item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="app" type="2a2b976b:PhpTreeStructureProvider$1" />
+ </path>
+ <path>
+ <item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
+ <item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="app" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="config" type="2a2b976b:PhpTreeStructureProvider$1" />
+ </path>
+ <path>
+ <item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
+ <item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
+ </path>
+ <path>
+ <item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
+ <item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="AppBundle" type="2a2b976b:PhpTreeStructureProvider$1" />
+ </path>
+ <path>
+ <item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
+ <item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="AppBundle" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="Controller" type="2a2b976b:PhpTreeStructureProvider$1" />
+ </path>
+ <path>
+ <item name="pollution-sensor" type="b2602c69:ProjectViewProjectNode" />
+ <item name="pollution-sensor" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="AppBundle" type="2a2b976b:PhpTreeStructureProvider$1" />
+ <item name="Utils" type="2a2b976b:PhpTreeStructureProvider$1" />
+ </path>
</expand>
<select />
</subPane>
@@ -182,6 +235,11 @@
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="Symfony2.SettingsForm" />
</component>
+ <component name="RecentsManager">
+ <key name="MoveFile.RECENT_KEYS">
+ <recent name="$PROJECT_DIR$/src/AppBundle" />
+ </key>
+ </component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
@@ -218,26 +276,28 @@
<workItem from="1511347081605" duration="1264000" />
<workItem from="1511428524892" duration="6187000" />
<workItem from="1511512197156" duration="4902000" />
- <workItem from="1511783758597" duration="4570000" />
+ <workItem from="1511783758597" duration="5066000" />
+ <workItem from="1512032567855" duration="9039000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
- <option name="totallyTimeSpent" value="17650000" />
+ <option name="totallyTimeSpent" value="27185000" />
</component>
<component name="ToolWindowManager">
- <frame x="67" y="25" width="1853" height="925" extended-state="6" />
+ <frame x="293" y="47" width="1853" height="925" extended-state="6" />
+ <editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12844037" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39968404" sideWeight="0.5036573" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
- <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25458997" sideWeight="0.4848485" order="7" side_tool="false" content_ui="tabs" />
- <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25458997" sideWeight="0.4848485" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39968404" sideWeight="0.49634275" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@@ -262,13 +322,40 @@
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php">
<provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="486">
+ <caret line="34" column="80" lean-forward="false" selection-start-line="34" selection-start-column="80" selection-end-line="34" selection-end-column="80" />
+ <folding>
+ <element signature="e#6#87#0#PHP" expanded="true" />
+ <element signature="e#122#181#0#PHP" expanded="true" />
+ <element signature="e#2399#2424#0#PHP" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/app/Resources/views/default/index.html.twig">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="360">
+ <caret line="20" column="70" lean-forward="false" selection-start-line="20" selection-start-column="70" selection-end-line="20" selection-end-column="70" />
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/web/js/realtime.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="1638">
+ <caret line="91" column="25" lean-forward="false" selection-start-line="91" selection-start-column="25" selection-end-line="91" selection-end-column="25" />
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php">
+ <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#6#87#0#PHP" expanded="true" />
<element signature="e#122#181#0#PHP" expanded="true" />
- <marker date="1511787169553" expanded="true" signature="328:1132" ph="{...}" />
- <marker date="1511787169553" expanded="true" signature="418:528" ph="{...}" />
+ <element signature="e#2399#2424#0#PHP" expanded="true" />
</folding>
</state>
</provider>
@@ -277,10 +364,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="666">
<caret line="37" column="40" lean-forward="false" selection-start-line="37" selection-start-column="40" selection-end-line="37" selection-end-column="40" />
- <folding>
- <element signature="e#6#87#0#PHP" expanded="false" />
- <element signature="e#122#181#0#PHP" expanded="false" />
- </folding>
</state>
</provider>
</entry>
@@ -304,7 +387,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="15" column="32" lean-forward="true" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" />
- <folding />
</state>
</provider>
</entry>
@@ -312,7 +394,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="216">
<caret line="12" column="1" lean-forward="false" selection-start-line="12" selection-start-column="1" selection-end-line="12" selection-end-column="1" />
- <folding />
</state>
</provider>
</entry>
@@ -323,8 +404,7 @@
<folding>
<element signature="e#6#87#0#PHP" expanded="true" />
<element signature="e#122#181#0#PHP" expanded="true" />
- <marker date="1511787169553" expanded="true" signature="328:1132" ph="{...}" />
- <marker date="1511787169553" expanded="true" signature="418:528" ph="{...}" />
+ <element signature="e#2399#2424#0#PHP" expanded="true" />
</folding>
</state>
</provider>
@@ -341,7 +421,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="18">
<caret line="1" column="13" lean-forward="false" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
- <folding />
</state>
</provider>
</entry>
@@ -356,7 +435,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
- <folding />
</state>
</provider>
</entry>
@@ -364,7 +442,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
- <folding />
</state>
</provider>
</entry>
@@ -372,7 +449,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
- <folding />
</state>
</provider>
</entry>
@@ -380,7 +456,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="18">
<caret line="1" column="13" lean-forward="false" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
- <folding />
</state>
</provider>
</entry>
@@ -405,13 +480,6 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/DefaultController.php" />
<entry file="file://$PROJECT_DIR$/src/AppBundle/View/Home.php" />
- <entry file="file://$PROJECT_DIR$/.gitignore">
- <provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="288">
- <caret line="16" column="13" lean-forward="true" selection-start-line="16" selection-start-column="13" selection-end-line="16" selection-end-column="13" />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/bin/console">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
@@ -435,21 +503,10 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/config/services.yml">
- <provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="-184">
- <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/NewDataController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="428">
<caret line="37" column="40" lean-forward="false" selection-start-line="37" selection-start-column="40" selection-end-line="37" selection-end-column="40" />
- <folding>
- <element signature="e#6#87#0#PHP" expanded="false" />
- <element signature="e#122#181#0#PHP" expanded="false" />
- </folding>
</state>
</provider>
</entry>
@@ -457,7 +514,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="15" column="32" lean-forward="false" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" />
- <folding />
</state>
</provider>
</entry>
@@ -465,38 +521,68 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="216">
<caret line="12" column="1" lean-forward="false" selection-start-line="12" selection-start-column="1" selection-end-line="12" selection-end-column="1" />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/AppBundle/Constants/gasTable.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="270">
+ <caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php">
+ <entry file="file://$PROJECT_DIR$/app/config/services.yml">
<provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="338">
- <caret line="34" column="80" lean-forward="false" selection-start-line="34" selection-start-column="80" selection-end-line="34" selection-end-column="80" />
- <folding>
- <element signature="e#6#87#0#PHP" expanded="true" />
- <element signature="e#122#181#0#PHP" expanded="true" />
- <marker date="1511787169553" expanded="true" signature="328:1132" ph="{...}" />
- <marker date="1511787169553" expanded="true" signature="418:528" ph="{...}" />
- </folding>
+ <state relative-caret-position="345">
+ <caret line="31" column="23" lean-forward="false" selection-start-line="31" selection-start-column="23" selection-end-line="31" selection-end-column="23" />
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/.gitignore">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="306">
+ <caret line="17" column="5" lean-forward="false" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
+ <folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/Resources/views/default/index.html.twig">
<provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="360">
- <caret line="20" column="70" lean-forward="false" selection-start-line="20" selection-start-column="70" selection-end-line="20" selection-end-column="70" />
+ <state relative-caret-position="342">
+ <caret line="19" column="21" lean-forward="false" selection-start-line="19" selection-start-column="21" selection-end-line="19" selection-end-column="21" />
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/AppBundle/Utils/Aqi.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="90">
+ <caret line="12" column="11" lean-forward="false" selection-start-line="12" selection-start-column="11" selection-end-line="12" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/web/js/realtime.js">
<provider selected="true" editor-type-id="text-editor">
- <state relative-caret-position="180">
- <caret line="91" column="25" lean-forward="false" selection-start-line="91" selection-start-column="25" selection-end-line="91" selection-end-column="25" />
+ <state relative-caret-position="684">
+ <caret line="71" column="29" lean-forward="false" selection-start-line="71" selection-start-column="29" selection-end-line="71" selection-end-column="29" />
<folding />
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/AppBundle/Controller/HomeController.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state relative-caret-position="302">
+ <caret line="56" column="113" lean-forward="false" selection-start-line="56" selection-start-column="113" selection-end-line="56" selection-end-column="113" />
+ <folding>
+ <element signature="e#6#87#0#PHP" expanded="true" />
+ <element signature="e#122#181#0#PHP" expanded="true" />
+ <element signature="e#2399#2424#0#PHP" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
</component>
</project> \ No newline at end of file
diff --git a/app/Resources/views/default/index.html.twig b/app/Resources/views/default/index.html.twig
index 1ec4bd6..2fc12a2 100644
--- a/app/Resources/views/default/index.html.twig
+++ b/app/Resources/views/default/index.html.twig
@@ -17,7 +17,7 @@
</tr>
</table>
</div>
- <p id="aq"></p>
+ <p id="aq">{{ Aqi }}</p>
<img src="https://www.ourair.org/wp-content/uploads/AQItable.gif">
{% endblock %}
{% block javascripts %}
diff --git a/app/config/services.yml b/app/config/services.yml
index cdb1c65..7ddee7c 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -29,6 +29,9 @@ services:
public: true
tags: ['controller.service_arguments']
+ AppBundle\Utils\Aqi:
+ public: false
+
# add more services, or override services that need manual wiring
# AppBundle\Service\ExampleService:
# arguments:
diff --git a/src/AppBundle/Controller/HomeController.php b/src/AppBundle/Controller/HomeController.php
index f6ee8b9..d8234cf 100644
--- a/src/AppBundle/Controller/HomeController.php
+++ b/src/AppBundle/Controller/HomeController.php
@@ -11,6 +11,9 @@ namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use AppBundle\Utils\Aqi;
+
+
class HomeController extends Controller
@@ -19,8 +22,21 @@ class HomeController extends Controller
* @Route("/", name="homepage")
*/
- public function numberAction()
+
+ public function numberAction(Aqi $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));
+
// Get cURL resource
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://pollutometerapi.azurewebsites.net/api/Readings/latest");
@@ -34,8 +50,18 @@ class HomeController extends Controller
$data = json_decode($resp, true);
$data['TimeStamp'] = gmdate("l jS \of F Y h:i:s A", $data['TimeStamp']);
+ $arr = [];
+ print_r($data);
+ $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);
+ $data['Aqi'] = $max;
+
- return $this->render('default/index.html.twig',$data);
+ return $this->render('default/index.html.twig', $data);
}
}
diff --git a/src/AppBundle/Utils/Aqi.php b/src/AppBundle/Utils/Aqi.php
new file mode 100644
index 0000000..6451c77
--- /dev/null
+++ b/src/AppBundle/Utils/Aqi.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: andy
+ * Date: 11/30/17
+ * Time: 11:27 AM
+ *
+ *
+ */
+
+Namespace AppBundle\Utils;
+
+class Aqi {
+ public function calculateAQI($gasName, $concentration, $table) {
+ $bpLow = 1;
+ $bpHi = 2;
+ $bpLowIndex = 1;
+ $bpHiIndex = 1;
+
+ $arr = $table ->{$gasName} ->{'breakpoints'};
+ foreach ($arr as $index => $value) {
+ if ($value < $concentration && $table->{$gasName}->{'breakpoints'}[$index + 1] > $concentration) {
+ $bpLow = $value;
+ $bpLowIndex = $index;
+ }
+
+ if ($value > $concentration && $table->{$gasName}->{'breakpoints'}[$index - 1] < $concentration) {
+ $bpHi = $value;
+ $bpHiIndex = $index;
+ }
+
+ };
+
+
+
+ $airQualityIndex = (($table->{$gasName}->{'aq'}[$bpHiIndex] - $table->{$gasName}->{'aq'}[$bpLowIndex]) / ($bpHi - $bpLow)) * ($concentration - $bpLow) + $table->{$gasName}->{'aq'}[$bpLowIndex];
+
+ return $airQualityIndex;
+
+ }
+}
+
+?> \ No newline at end of file