4
0
Эх сурвалжийг харах

Refactor some if statements

Alexis Degrugillier 11 жил өмнө
parent
commit
960abfcc65

+ 2 - 4
app/Models/StatsDAO.php

@@ -151,10 +151,9 @@ SQL;
 	 * @return string
 	 */
 	protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) {
+		$restrict = '';
 		if ($feed) {
 			$restrict = "WHERE e.id_feed = {$feed}";
-		} else {
-			$restrict = '';
 		}
 		$sql = <<<SQL
 SELECT DATE_FORMAT(FROM_UNIXTIME(e.date), '{$period}') AS period
@@ -214,10 +213,9 @@ SQL;
 	 * @return integer
 	 */
 	protected function calculateEntryAveragePerFeedPerPeriod($period, $feed = null) {
+		$restrict = '';
 		if ($feed) {
 			$restrict = "WHERE e.id_feed = {$feed}";
-		} else {
-			$restrict = '';
 		}
 		$sql = <<<SQL
 SELECT COUNT(1) AS count