| @@ 696-715 (lines=20) @@ | ||
| 693 | return $data; |
|
| 694 | } |
|
| 695 | ||
| 696 | public function getNestData($time) { |
|
| 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 | " . $pokemon_exclude_sql . " |
|
| 706 | GROUP BY p.spawn_id, p.pokemon_id |
|
| 707 | HAVING COUNT(p.pokemon_id) >= ".($time / 4)." |
|
| 708 | ORDER BY p.pokemon_id"; |
|
| 709 | $result = $this->mysqli->query($req); |
|
| 710 | $nests = array(); |
|
| 711 | while ($data = $result->fetch_object()) { |
|
| 712 | $nests[] = $data; |
|
| 713 | } |
|
| 714 | return $nests; |
|
| 715 | } |
|
| 716 | ||
| 717 | } |
|
| 718 | ||
| @@ 683-702 (lines=20) @@ | ||
| 680 | return $data; |
|
| 681 | } |
|
| 682 | ||
| 683 | public function getNestData($time) { |
|
| 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 | " . $pokemon_exclude_sql . " |
|
| 693 | GROUP BY p.spawnpoint_id, p.pokemon_id |
|
| 694 | HAVING COUNT(p.pokemon_id) >= ".($time / 4)." |
|
| 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 | } |
|