Code Duplication    Length = 15-16 lines in 2 locations

core/process/queries/QueryManagerPostgresqlMonocleAlternate.php 2 locations

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