Skip to content

A free, self-hostable news aggregator…

Refactor some if statements

Alexis Degrugillier960abfcc6558
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index 0ca251228..255a2b1ff 100644
--- a/app/Models/StatsDAO.php
+++ b/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