| @@ 678-698 (lines=21) @@ | ||
| 675 | return $data; |
|
| 676 | } |
|
| 677 | ||
| 678 | public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 679 | $pokemon_exclude_sql = ""; |
|
| 680 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 681 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
|
| 682 | } |
|
| 683 | $req = "SELECT p.pokemon_id, MAX(p.lat) AS latitude, MAX(p.lon) AS longitude, count(p.pokemon_id) AS total_pokemon, MAX(s.updated) as latest_seen, coalesce(CASE WHEN MAX(duration) = 0 THEN NULL ELSE MAX(duration) END ,30)*60 as duration |
|
| 684 | FROM sightings p |
|
| 685 | INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id) |
|
| 686 | WHERE p.expire_timestamp > UNIX_TIMESTAMP() - ".($time * 3600)." |
|
| 687 | AND p.lat >= ".$minLatitude." AND p.lat < ".$maxLatitude." AND p.lon >= ".$minLongitude." AND p.lon < ".$maxLongitude." |
|
| 688 | " . $pokemon_exclude_sql . " |
|
| 689 | GROUP BY p.spawn_id, p.pokemon_id |
|
| 690 | HAVING COUNT(p.pokemon_id) >= ".($time / 4)." |
|
| 691 | ORDER BY p.pokemon_id"; |
|
| 692 | $result = $this->mysqli->query($req); |
|
| 693 | $nests = array(); |
|
| 694 | while ($data = $result->fetch_object()) { |
|
| 695 | $nests[] = $data; |
|
| 696 | } |
|
| 697 | return $nests; |
|
| 698 | } |
|
| 699 | ||
| 700 | public function getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 701 | $req = "SELECT COUNT(*) as total |
|
| @@ 665-685 (lines=21) @@ | ||
| 662 | return $data; |
|
| 663 | } |
|
| 664 | ||
| 665 | public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 666 | $pokemon_exclude_sql = ""; |
|
| 667 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 668 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")"; |
|
| 669 | } |
|
| 670 | $req = "SELECT p.pokemon_id, MAX(p.latitude) AS latitude, MAX(p.longitude) AS longitude, count(p.pokemon_id) AS total_pokemon, MAX(UNIX_TIMESTAMP(s.latest_seen)) as latest_seen, (LENGTH(s.kind) - LENGTH( REPLACE ( MAX(kind), \"s\", \"\") )) * 900 AS duration |
|
| 671 | FROM pokemon p |
|
| 672 | INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id) |
|
| 673 | WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL ".($time)." HOUR |
|
| 674 | AND p.latitude >= ".$minLatitude." AND p.latitude < ".$maxLatitude." AND p.longitude >= ".$minLongitude." AND p.longitude < ".$maxLongitude." |
|
| 675 | " . $pokemon_exclude_sql . " |
|
| 676 | GROUP BY p.spawnpoint_id, p.pokemon_id |
|
| 677 | HAVING COUNT(p.pokemon_id) >= ".($time / 4)." |
|
| 678 | ORDER BY p.pokemon_id"; |
|
| 679 | $result = $this->mysqli->query($req); |
|
| 680 | $nests = array(); |
|
| 681 | while ($data = $result->fetch_object()) { |
|
| 682 | $nests[] = $data; |
|
| 683 | } |
|
| 684 | return $nests; |
|
| 685 | } |
|
| 686 | ||
| 687 | public function getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 688 | $req = "SELECT COUNT(*) as total |
|