Code Duplication    Length = 15-16 lines in 2 locations

core/process/queries/QueryManagerPostgresqlMonocleAlternate.php 2 locations

@@ 434-448 (lines=15) @@
431
		return $counts;
432
	}
433
434
	public function getPokemonSinceLastUpdate($pokemon_id, $last_update) {
435
		$where = "WHERE pokemon_id = '".$pokemon_id."' AND id > '".$last_update."'";
436
		$req = "SELECT count, id AS last_timestamp, (TO_TIMESTAMP(expire_timestamp)) AS disappear_time_real, lat as latitude, lon as longitude
437
					FROM sightings
438
					JOIN (SELECT COUNT(*) AS count
439
						FROM sightings
440
                    	" . $where. "
441
                    ) count ON 1 = 1
442
					" . $where . "
443
					ORDER BY expire_timestamp DESC
444
					LIMIT 1 OFFSET 0";
445
		$result = pg_query($this->db, $req);
446
		$data = pg_fetch_object($result);
447
		return $data;
448
	}
449
450
	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
451
		$where = "WHERE pokemon_id = '".$pokemon_id."' AND time_battle > '".$last_update."'";
@@ 450-465 (lines=16) @@
447
		return $data;
448
	}
449
450
	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
451
		$where = "WHERE pokemon_id = '".$pokemon_id."' AND time_battle > '".$last_update."'";
452
		$req = "SELECT time_battle AS start_timestamp, time_end as end, (TO_TIMESTAMP(time_end)) AS end_time_real, lat as latitude, lon as longitude, count
453
					FROM raids r
454
					JOIN forts g ON r.fort_id = g.id
455
					JOIN (SELECT COUNT(*) AS count
456
						FROM raids
457
                    	" . $where."
458
                    ) count ON 1 = 1 
459
	                " . $where."
460
	                ORDER BY time_battle DESC
461
					LIMIT 1 OFFSET 0";
462
		$result = pg_query($this->db, $req);
463
		$data = pg_fetch_object($result);
464
		return $data;
465
	}
466
467
	public function getCaptchaCount() {
468
		$req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL";