| @@ 696-716 (lines=21) @@ | ||
| 693 | return $data; |
|
| 694 | } |
|
| 695 | ||
| 696 | public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 697 | $pokemon_exclude_sql = ""; |
|
| 698 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 699 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
|
| 700 | } |
|
| 701 | $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 |
|
| 702 | FROM sightings p |
|
| 703 | INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id) |
|
| 704 | WHERE p.expire_timestamp > UNIX_TIMESTAMP() - ".($time * 3600)." |
|
| 705 | AND p.lat >= ".$minLatitude." AND p.lat < ".$maxLatitude." AND p.lon >= ".$minLongitude." AND p.lon < ".$maxLongitude." |
|
| 706 | " . $pokemon_exclude_sql . " |
|
| 707 | GROUP BY p.spawn_id, p.pokemon_id |
|
| 708 | HAVING COUNT(p.pokemon_id) >= ".($time / 4)." |
|
| 709 | ORDER BY p.pokemon_id"; |
|
| 710 | $result = $this->mysqli->query($req); |
|
| 711 | $nests = array(); |
|
| 712 | while ($data = $result->fetch_object()) { |
|
| 713 | $nests[] = $data; |
|
| 714 | } |
|
| 715 | return $nests; |
|
| 716 | } |
|
| 717 | ||
| 718 | public function getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 719 | $req = "SELECT COUNT(*) as total |
|
| @@ 683-703 (lines=21) @@ | ||
| 680 | return $data; |
|
| 681 | } |
|
| 682 | ||
| 683 | public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 684 | $pokemon_exclude_sql = ""; |
|
| 685 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 686 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")"; |
|
| 687 | } |
|
| 688 | $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 |
|
| 689 | FROM pokemon p |
|
| 690 | INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id) |
|
| 691 | WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL ".($time)." HOUR |
|
| 692 | AND p.latitude >= ".$minLatitude." AND p.latitude < ".$maxLatitude." AND p.longitude >= ".$minLongitude." AND p.longitude < ".$maxLongitude." |
|
| 693 | " . $pokemon_exclude_sql . " |
|
| 694 | GROUP BY p.spawnpoint_id, p.pokemon_id |
|
| 695 | HAVING COUNT(p.pokemon_id) >= ".($time / 4)." |
|
| 696 | ORDER BY p.pokemon_id"; |
|
| 697 | $result = $this->mysqli->query($req); |
|
| 698 | $nests = array(); |
|
| 699 | while ($data = $result->fetch_object()) { |
|
| 700 | $nests[] = $data; |
|
| 701 | } |
|
| 702 | return $nests; |
|
| 703 | } |
|
| 704 | ||
| 705 | public function getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude) { |
|
| 706 | $req = "SELECT COUNT(*) as total |
|