diff options
| author | Shadify <boomkin1234@hotmail.com> | 2017-12-04 10:01:06 +0100 | 
|---|---|---|
| committer | Shadify <boomkin1234@hotmail.com> | 2017-12-04 10:01:06 +0100 | 
| commit | 074799d1471df407663931d6654847fa38484a3e (patch) | |
| tree | c6dc3169407077e4aee786a5b52a7d5637c4d2f3 /src/AppBundle | |
| parent | ccf443791736af36391e9274a5633ef2269ecfc0 (diff) | |
Fixed breakpoint in AQI calculation
Diffstat (limited to 'src/AppBundle')
| -rw-r--r-- | src/AppBundle/Controller/NewDataController.php | 1 | ||||
| -rw-r--r-- | src/AppBundle/Utils/Aqi.php | 4 | 
2 files changed, 2 insertions, 3 deletions
| diff --git a/src/AppBundle/Controller/NewDataController.php b/src/AppBundle/Controller/NewDataController.php index ecb1be9..5dd440f 100644 --- a/src/AppBundle/Controller/NewDataController.php +++ b/src/AppBundle/Controller/NewDataController.php @@ -36,7 +36,6 @@ class NewDataController extends Controller          $response = new Response($data);          $response->headers->set('Content-Type', 'application/json'); -          return $response;      } diff --git a/src/AppBundle/Utils/Aqi.php b/src/AppBundle/Utils/Aqi.php index 6451c77..1b324a8 100644 --- a/src/AppBundle/Utils/Aqi.php +++ b/src/AppBundle/Utils/Aqi.php @@ -19,12 +19,12 @@ class Aqi {          $arr = $table ->{$gasName} ->{'breakpoints'};          foreach ($arr as $index => $value) { -            if ($value < $concentration && $table->{$gasName}->{'breakpoints'}[$index + 1] > $concentration) { +            if ($value <= $concentration && $table->{$gasName}->{'breakpoints'}[$index + 1] >= $concentration) {                  $bpLow = $value;                  $bpLowIndex = $index;              } -            if ($value > $concentration && $table->{$gasName}->{'breakpoints'}[$index - 1] < $concentration) { +            if ($value >= $concentration && $table->{$gasName}->{'breakpoints'}[$index - 1] <= $concentration) {                  $bpHi = $value;                  $bpHiIndex = $index;              } |