Code Duplication    Length = 21-21 lines in 2 locations

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 783-803 (lines=21) @@
780
        return $data;
781
    }
782
783
    public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude)
784
    {
785
        $pokemon_exclude_sql = '';
786
        if (!empty(self::$config->system->nest_exclude_pokemon)) {
787
            $pokemon_exclude_sql = 'AND p.pokemon_id NOT IN ('.implode(',', self::$config->system->nest_exclude_pokemon).')';
788
        }
789
        $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
790
			          FROM sightings p
791
			          INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id)
792
			          WHERE p.expire_timestamp > UNIX_TIMESTAMP() - '.($time * 3600).'
793
			            AND p.lat >= '.$minLatitude.' AND p.lat < '.$maxLatitude.' AND p.lon >= '.$minLongitude.' AND p.lon < '.$maxLongitude.'
794
			          '.$pokemon_exclude_sql.'
795
			          GROUP BY p.spawn_id, p.pokemon_id
796
			          HAVING COUNT(p.pokemon_id) >= '.($time / 4).'
797
			          ORDER BY p.pokemon_id';
798
        $result = $this->mysqli->query($req);
799
        $nests = array();
800
        while ($data = $result->fetch_object()) {
801
            $nests[] = $data;
802
        }
803
804
        return $nests;
805
    }
806

core/process/queries/QueryManagerMysqlRocketmap.php 1 location

@@ 820-840 (lines=21) @@
817
        return $data;
818
    }
819
820
    public function getNestData($time, $minLatitude, $maxLatitude, $minLongitude, $maxLongitude)
821
    {
822
        $pokemon_exclude_sql = '';
823
        if (!empty(self::$config->system->nest_exclude_pokemon)) {
824
            $pokemon_exclude_sql = 'AND pokemon_id NOT IN ('.implode(',', self::$config->system->nest_exclude_pokemon).')';
825
        }
826
        $req = 'SELECT spawnpoint_id, pokemon_id, MAX(latitude) AS latitude, MAX(longitude) AS longitude, count(pokemon_id) AS total_pokemon,
827
				MAX(UNIX_TIMESTAMP(disappear_time)) as latest_seen
828
				FROM pokemon
829
				WHERE disappear_time > (UTC_TIMESTAMP() - INTERVAL '.$time.' HOUR)
830
				AND latitude >= '.$minLatitude.' AND latitude < '.$maxLatitude.' AND longitude >= '.$minLongitude.' AND longitude < '.$maxLongitude.'
831
				'.$pokemon_exclude_sql.' 
832
				GROUP BY spawnpoint_id, pokemon_id 
833
				HAVING COUNT(pokemon_id) >= '.($time / 4).'
834
				ORDER BY pokemon_id';
835
        $result = $this->mysqli->query($req);
836
        $nests = array();
837
        while ($data = $result->fetch_object()) {
838
            $nests[] = $data;
839
        }
840
841
        return $nests;
842
    }
843