| @@ 245-259 (lines=15) @@ | ||
| 242 | return $points; |
|
| 243 | } |
|
| 244 | ||
| 245 | public function getPokemonGraph($pokemon_id) |
|
| 246 | { |
|
| 247 | $req = "SELECT COUNT(*) AS total, HOUR(disappear_time) AS disappear_hour |
|
| 248 | FROM (SELECT FROM_UNIXTIME(expire_timestamp) as disappear_time FROM sightings WHERE pokemon_id = '".$pokemon_id."' LIMIT 100000) AS pokemonFiltered |
|
| 249 | GROUP BY disappear_hour |
|
| 250 | ORDER BY disappear_hour"; |
|
| 251 | $result = $this->mysqli->query($req); |
|
| 252 | $array = array_fill(0, 24, 0); |
|
| 253 | while ($result && $data = $result->fetch_object()) { |
|
| 254 | $array[$data->disappear_hour] = $data->total; |
|
| 255 | } |
|
| 256 | // shift array because AM/PM starts at 1AM not 0:00 |
|
| 257 | $array[] = $array[0]; |
|
| 258 | array_shift($array); |
|
| 259 | ||
| 260 | return $array; |
|
| 261 | } |
|
| 262 | ||
| @@ 247-262 (lines=16) @@ | ||
| 244 | return $points; |
|
| 245 | } |
|
| 246 | ||
| 247 | public function getPokemonGraph($pokemon_id) |
|
| 248 | { |
|
| 249 | $req = "SELECT COUNT(*) AS total, |
|
| 250 | HOUR(CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_hour |
|
| 251 | FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' LIMIT 100000) AS pokemonFiltered |
|
| 252 | GROUP BY disappear_hour |
|
| 253 | ORDER BY disappear_hour"; |
|
| 254 | $result = $this->mysqli->query($req); |
|
| 255 | $array = array_fill(0, 24, 0); |
|
| 256 | while ($result && $data = $result->fetch_object()) { |
|
| 257 | $array[$data->disappear_hour] = $data->total; |
|
| 258 | } |
|
| 259 | // shift array because AM/PM starts at 1AM not 0:00 |
|
| 260 | $array[] = $array[0]; |
|
| 261 | array_shift($array); |
|
| 262 | ||
| 263 | return $array; |
|
| 264 | } |
|
| 265 | ||