| @@ 697-716 (lines=20) @@ | ||
| 694 | return $data; |
|
| 695 | } |
|
| 696 | ||
| 697 | public function getNestData() { |
|
| 698 | $pokemon_exclude_sql = ""; |
|
| 699 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 700 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
|
| 701 | } |
|
| 702 | $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 |
|
| 703 | FROM sightings p |
|
| 704 | INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id) |
|
| 705 | WHERE p.expire_timestamp > UNIX_TIMESTAMP() - 86400 |
|
| 706 | " . $pokemon_exclude_sql . " |
|
| 707 | GROUP BY p.spawn_id, p.pokemon_id |
|
| 708 | HAVING COUNT(p.pokemon_id) >= 6 |
|
| 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 | } |
|
| 719 | ||
| @@ 683-702 (lines=20) @@ | ||
| 680 | return $data; |
|
| 681 | } |
|
| 682 | ||
| 683 | public function getNestData() { |
|
| 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 24 HOUR |
|
| 692 | " . $pokemon_exclude_sql . " |
|
| 693 | GROUP BY p.spawnpoint_id, p.pokemon_id |
|
| 694 | HAVING COUNT(p.pokemon_id) >= 6 |
|
| 695 | ORDER BY p.pokemon_id"; |
|
| 696 | $result = $this->mysqli->query($req); |
|
| 697 | $nests = array(); |
|
| 698 | while ($data = $result->fetch_object()) { |
|
| 699 | $nests[] = $data; |
|
| 700 | } |
|
| 701 | return $nests; |
|
| 702 | } |
|
| 703 | ||
| 704 | } |
|