Code Duplication    Length = 21-21 lines in 2 locations

core/process/queries/QueryManagerMysqlMonocleAlternate.php 1 location

@@ 176-196 (lines=21) @@
173
		return $top;
174
	}
175
176
	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) {
177
		$trainer_blacklist = "";
178
		if (!empty(self::$config->system->trainer_blacklist)) {
179
			$trainer_blacklist = " AND owner_name NOT IN ('" . implode("','", self::$config->system->trainer_blacklist) . "')";
180
		}
181
182
		$req = "SELECT owner_name as trainer_name, ROUND((100*((atk_iv)+(def_iv)+(sta_iv))/45),1) AS IV, move_1, move_2, cp as cp,
183
                FROM_UNIXTIME(last_modified) AS lasttime, last_modified as last_seen
184
                FROM gym_defenders
185
				WHERE pokemon_id = '" . $pokemon_id . "'" . $trainer_blacklist . "
186
				ORDER BY $best_order_by $best_direction, owner_name ASC
187
				LIMIT 0,50";
188
189
		$result = $this->mysqli->query($req);
190
		$toptrainer = array();
191
		while ($data = $result->fetch_object()) {
192
			$toptrainer[] = $data;
193
		}
194
		return $toptrainer;
195
	}
196
197
	public function getPokemonHeatmap($pokemon_id, $start, $end) {
198
		$where = " WHERE pokemon_id = ".$pokemon_id." "
199
			. "AND FROM_UNIXTIME(expire_timestamp) BETWEEN '".$start."' AND '".$end."'";

core/process/queries/QueryManagerMysqlRocketmap.php 1 location

@@ 177-197 (lines=21) @@
174
		return $top;
175
	}
176
177
	function getTop50Trainers($pokemon_id, $best_order_by, $best_direction) {
178
		$trainer_blacklist = "";
179
		if (!empty(self::$config->system->trainer_blacklist)) {
180
			$trainer_blacklist = " AND trainer_name NOT IN ('".implode("','", self::$config->system->trainer_blacklist)."')";
181
		}
182
183
		$req = "SELECT trainer_name, ROUND(SUM(100*(iv_attack+iv_defense+iv_stamina)/45),1) AS IV, move_1, move_2, cp,
184
						DATE_FORMAT(last_seen, '%Y-%m-%d') AS lasttime, last_seen
185
						FROM gympokemon
186
						WHERE pokemon_id = '".$pokemon_id."'".$trainer_blacklist."
187
						ORDER BY $best_order_by $best_direction, trainer_name ASC
188
						LIMIT 0,50";
189
190
		$result = $this->mysqli->query($req);
191
		$toptrainer = array();
192
		while ($data = $result->fetch_object()) {
193
			$toptrainer[] = $data;
194
		}
195
		return $toptrainer;
196
	}
197
198
	public function getPokemonHeatmap($pokemon_id, $start, $end) {
199
		$where = " WHERE pokemon_id = ".$pokemon_id." "
200
			. "AND disappear_time BETWEEN '".$start."' AND '".$end."'";