| @@ 471-490 (lines=20) @@ | ||
| 468 | return $data; |
|
| 469 | } |
|
| 470 | ||
| 471 | public function getNestData() { |
|
| 472 | $pokemon_exclude_sql = ""; |
|
| 473 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 474 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")"; |
|
| 475 | } |
|
| 476 | $req = "SELECT p.pokemon_id, p.lat AS latitude, p.lon AS longitude, count(p.pokemon_id) AS total_pokemon, FROM_UNIXTIME(s.updated) as latest_seen, coalesce(duration,30)*60 as duration |
|
| 477 | FROM sightings p |
|
| 478 | INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id) |
|
| 479 | WHERE p.expire_timestamp > UNIX_TIMESTAMP() - 86400 |
|
| 480 | " . $pokemon_exclude_sql . " |
|
| 481 | GROUP BY p.spawn_id, p.pokemon_id |
|
| 482 | HAVING COUNT(p.pokemon_id) >= 6 |
|
| 483 | ORDER BY p.pokemon_id"; |
|
| 484 | $result = $this->mysqli->query($req); |
|
| 485 | $nests = array(); |
|
| 486 | while ($data = $result->fetch_object()) { |
|
| 487 | $nests[] = $data; |
|
| 488 | } |
|
| 489 | return $nests; |
|
| 490 | } |
|
| 491 | ||
| 492 | } |
|
| @@ 580-599 (lines=20) @@ | ||
| 577 | return $data; |
|
| 578 | } |
|
| 579 | ||
| 580 | public function getNestData() { |
|
| 581 | $pokemon_exclude_sql = ""; |
|
| 582 | if (!empty(self::$config->system->nest_exclude_pokemon)) { |
|
| 583 | $pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")"; |
|
| 584 | } |
|
| 585 | $req = "SELECT p.pokemon_id, max(p.latitude) AS latitude, max(p.longitude) AS longitude, count(p.pokemon_id) AS total_pokemon, s.latest_seen, (LENGTH(s.kind) - LENGTH( REPLACE ( kind, \"s\", \"\") )) * 900 AS duration |
|
| 586 | FROM pokemon p |
|
| 587 | INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id) |
|
| 588 | WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL 24 HOUR |
|
| 589 | " . $pokemon_exclude_sql . " |
|
| 590 | GROUP BY p.spawnpoint_id, p.pokemon_id |
|
| 591 | HAVING COUNT(p.pokemon_id) >= 6 |
|
| 592 | ORDER BY p.pokemon_id"; |
|
| 593 | $result = $this->mysqli->query($req); |
|
| 594 | $nests = array(); |
|
| 595 | while ($data = $result->fetch_object()) { |
|
| 596 | $nests[] = $data; |
|
| 597 | } |
|
| 598 | return $nests; |
|
| 599 | } |
|
| 600 | ||
| 601 | } |
|