| @@ 661-680 (lines=20) @@ | ||
| 658 | return $data; |
|
| 659 | } |
|
| 660 | ||
| 661 | public function getNestData() { |
|
| 662 | $pokemon_exclude_sql = ""; |
|
| 663 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 664 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")"; |
|
| 665 | } |
|
| 666 | $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 |
|
| 667 | FROM pokemon p |
|
| 668 | INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id) |
|
| 669 | WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL 24 HOUR |
|
| 670 | " . $pokemon_exclude_sql . " |
|
| 671 | GROUP BY p.spawnpoint_id, p.pokemon_id |
|
| 672 | HAVING COUNT(p.pokemon_id) >= 6 |
|
| 673 | ORDER BY p.pokemon_id"; |
|
| 674 | $result = $this->mysqli->query($req); |
|
| 675 | $nests = array(); |
|
| 676 | while ($data = $result->fetch_object()) { |
|
| 677 | $nests[] = $data; |
|
| 678 | } |
|
| 679 | return $nests; |
|
| 680 | } |
|
| 681 | ||
| 682 | } |
|
| @@ 503-522 (lines=20) @@ | ||
| 500 | return $data; |
|
| 501 | } |
|
| 502 | ||
| 503 | public function getNestData() { |
|
| 504 | $pokemon_exclude_sql = ""; |
|
| 505 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 506 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
|
| 507 | } |
|
| 508 | $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 |
|
| 509 | FROM sightings p |
|
| 510 | INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id) |
|
| 511 | WHERE p.expire_timestamp > UNIX_TIMESTAMP() - 86400 |
|
| 512 | " . $pokemon_exclude_sql . " |
|
| 513 | GROUP BY p.spawn_id, p.pokemon_id |
|
| 514 | HAVING COUNT(p.pokemon_id) >= 6 |
|
| 515 | ORDER BY p.pokemon_id"; |
|
| 516 | $result = $this->mysqli->query($req); |
|
| 517 | $nests = array(); |
|
| 518 | while ($data = $result->fetch_object()) { |
|
| 519 | $nests[] = $data; |
|
| 520 | } |
|
| 521 | return $nests; |
|
| 522 | } |
|
| 523 | ||
| 524 | } |
|
| 525 | ||