Code Duplication    Length = 21-21 lines in 2 locations

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 747-767 (lines=21) @@
744
        return $data;
745
    }
746
747
    public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude)
748
    {
749
        $pokemon_exclude_sql = '';
750
        if (!empty(self::$config->system->nest_exclude_pokemon)) {
751
            $pokemon_exclude_sql = 'AND p.pokemon_id NOT IN ('.implode(',', self::$config->system->nest_exclude_pokemon).')';
752
        }
753
        $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
754
			          FROM sightings p
755
			          INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id)
756
			          WHERE p.expire_timestamp > UNIX_TIMESTAMP() - '.($time * 3600).'
757
			            AND p.lat >= '.$minLatitude.' AND p.lat < '.$maxLatitude.' AND p.lon >= '.$minLongitude.' AND p.lon < '.$maxLongitude.'
758
			          '.$pokemon_exclude_sql.'
759
			          GROUP BY p.spawn_id, p.pokemon_id
760
			          HAVING COUNT(p.pokemon_id) >= '.($time / 4).'
761
			          ORDER BY p.pokemon_id';
762
        $result = $this->mysqli->query($req);
763
        $nests = array();
764
        while ($data = $result->fetch_object()) {
765
            $nests[] = $data;
766
        }
767
768
        return $nests;
769
    }
770

core/process/queries/QueryManagerMysqlRocketmap.php 1 location

@@ 780-800 (lines=21) @@
777
        return $data;
778
    }
779
780
    public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude)
781
    {
782
        $pokemon_exclude_sql = '';
783
        if (!empty(self::$config->system->nest_exclude_pokemon)) {
784
            $pokemon_exclude_sql = 'AND pokemon_id NOT IN ('.implode(',', self::$config->system->nest_exclude_pokemon).')';
785
        }
786
        $req = 'SELECT spawnpoint_id, pokemon_id, MAX(latitude) AS latitude, MAX(longitude) AS longitude, count(pokemon_id) AS total_pokemon,
787
				MAX(UNIX_TIMESTAMP(disappear_time)) as latest_seen
788
				FROM pokemon
789
				WHERE disappear_time > (UTC_TIMESTAMP() - INTERVAL '.$time.' HOUR)
790
				AND latitude >= '.$minLatitude.' AND latitude < '.$maxLatitude.' AND longitude >= '.$minLongitude.' AND longitude < '.$maxLongitude.'
791
				'.$pokemon_exclude_sql.' 
792
				GROUP BY spawnpoint_id, pokemon_id 
793
				HAVING COUNT(pokemon_id) >= '.($time / 4).'
794
				ORDER BY pokemon_id';
795
        $result = $this->mysqli->query($req);
796
        $nests = array();
797
        while ($data = $result->fetch_object()) {
798
            $nests[] = $data;
799
        }
800
801
        return $nests;
802
    }
803