Code Duplication    Length = 15-16 lines in 2 locations

core/process/queries/QueryManagerPostgresqlMonocleAlternate.php 2 locations

@@ 657-671 (lines=15) @@
654
		return $counts;
655
	}
656
657
	public function getPokemonSinceLastUpdate($pokemon_id, $last_update) {
658
		$where = "WHERE p.pokemon_id = '".$pokemon_id."' AND p.expire_timestamp - (coalesce(CASE WHEN duration = 0 THEN NULL ELSE duration END ,30)*60) > '".$last_update."'";
659
		$req = "SELECT count, p.expire_timestamp - (coalesce(CASE WHEN duration = 0 THEN NULL ELSE duration END ,30)*60) AS last_timestamp, (TO_TIMESTAMP(expire_timestamp)) AS disappear_time_real, lat as latitude, lon as longitude
660
					FROM sightings p
661
					LEFT JOIN spawnpoints s ON p.spawn_id = s.spawn_id
662
				  	JOIN (SELECT COUNT(*) AS count
663
						FROM FROM sightings p
664
						LEFT JOIN spawnpoints s ON p.spawn_id = s.spawn_id
665
                    	" . $where. "
666
                    ) count ON 1 = 1
667
					" . $where . "
668
					ORDER BY last_timestamp DESC
669
					LIMIT 1 OFFSET 0";
670
		$result = pg_query($this->db, $req);
671
		$data = pg_fetch_object($result);
672
		return $data;
673
	}
674
@@ 675-690 (lines=16) @@
672
		return $data;
673
	}
674
675
	public function getRaidsSinceLastUpdate($pokemon_id, $last_update) {
676
		$where = "WHERE pokemon_id = '".$pokemon_id."' AND time_battle > '".$last_update."'";
677
		$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
678
					FROM raids r
679
					JOIN forts g ON r.fort_id = g.id
680
					JOIN (SELECT COUNT(*) AS count
681
						FROM raids
682
                    	" . $where."
683
                    ) count ON 1 = 1
684
	                " . $where."
685
	                ORDER BY time_battle DESC
686
					LIMIT 1 OFFSET 0";
687
		$result = pg_query($this->db, $req);
688
		$data = pg_fetch_object($result);
689
		return $data;
690
	}
691
692
	public function getCaptchaCount() {
693
		$req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL";