Code Duplication    Length = 20-20 lines in 2 locations

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 678-697 (lines=20) @@
675
		return $data;
676
	}
677
678
	public function getNestData() {
679
		$pokemon_exclude_sql = "";
680
		if (!empty(self::$config->system->nest_exclude_pokemon)) {
681
			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (" . implode(",", self::$config->system->nest_exclude_pokemon) . ")";
682
		}
683
		$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
684
			          FROM sightings p
685
			          INNER JOIN spawnpoints s ON (p.spawn_id = s.spawn_id)
686
			          WHERE p.expire_timestamp > UNIX_TIMESTAMP() - 86400
687
			          " . $pokemon_exclude_sql . "
688
			          GROUP BY p.spawn_id, p.pokemon_id
689
			          HAVING COUNT(p.pokemon_id) >= 6
690
			          ORDER BY p.pokemon_id";
691
		$result = $this->mysqli->query($req);
692
		$nests = array();
693
		while ($data = $result->fetch_object()) {
694
			$nests[] = $data;
695
		}
696
		return $nests;
697
	}
698
699
}
700

core/process/queries/QueryManagerMysqlRocketmap.php 1 location

@@ 665-684 (lines=20) @@
662
		return $data;
663
	}
664
665
	public function getNestData() {
666
		$pokemon_exclude_sql = "";
667
		if (!empty(self::$config->system->nest_exclude_pokemon)) {
668
			$pokemon_exclude_sql = "AND p.pokemon_id NOT IN (".implode(",", self::$config->system->nest_exclude_pokemon).")";
669
		}
670
		$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
671
			          FROM pokemon p
672
			          INNER JOIN spawnpoint s ON (p.spawnpoint_id = s.id)
673
			          WHERE p.disappear_time > UTC_TIMESTAMP() - INTERVAL 24 HOUR
674
			          " . $pokemon_exclude_sql . "
675
			          GROUP BY p.spawnpoint_id, p.pokemon_id
676
			          HAVING COUNT(p.pokemon_id) >= 6
677
			          ORDER BY p.pokemon_id";
678
		$result = $this->mysqli->query($req);
679
		$nests = array();
680
		while ($data = $result->fetch_object()) {
681
			$nests[] = $data;
682
		}
683
		return $nests;
684
	}
685
686
}
687