Browse Source

Refactor some if statements

Alexis Degrugillier 11 years ago
parent
commit
960abfcc65
1 changed files with 2 additions and 4 deletions
  1. 2 4
      app/Models/StatsDAO.php

+ 2 - 4
app/Models/StatsDAO.php

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