Browse Source

getCategoryCounters: properly handle categories which don't have any stored feeds/articles

Andrew Dolgov 1 month ago
parent
commit
47135160d1
1 changed files with 4 additions and 4 deletions
  1. 4 4
      classes/counters.php

+ 4 - 4
classes/counters.php

@@ -29,10 +29,10 @@ class Counters {
        			SUM(CASE WHEN marked THEN 1 ELSE 0 END) AS count_marked,
        			(SELECT COUNT(id) FROM ttrss_feed_categories fcc
        			WHERE fcc.parent_cat = fc.id) AS num_children
-			FROM ttrss_feed_categories fc, ttrss_feeds f, ttrss_user_entries ue
-			WHERE f.cat_id = fc.id AND
-			  ue.feed_id = f.id AND
-			  ue.owner_uid = :uid
+			FROM ttrss_feed_categories fc
+    			LEFT JOIN ttrss_feeds f ON (f.cat_id = fc.id)
+    			LEFT JOIN ttrss_user_entries ue ON (ue.feed_id = f.id)
+			WHERE fc.owner_uid = :uid
 			GROUP BY fc.id
 		UNION
 			SELECT 0,