]> git.wh0rd.org Git - tt-rss.git/commitdiff
api, getCategories: properly return information for categories with 0 feeds, but...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 24 Mar 2013 10:46:45 +0000 (14:46 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 24 Mar 2013 10:46:45 +0000 (14:46 +0400)
classes/api.php

index ec1219fe104a243377e570197baf71a9933ba276..44130d39777d7ff9f534a7ea9acf671900622229 100644 (file)
@@ -133,7 +133,10 @@ class API extends Handler {
                $result = db_query($this->link, "SELECT
                                id, title, order_id, (SELECT COUNT(id) FROM
                                ttrss_feeds WHERE
-                               ttrss_feed_categories.id IS NOT NULL AND cat_id = ttrss_feed_categories.id) AS num_feeds
+                               ttrss_feed_categories.id IS NOT NULL AND cat_id = ttrss_feed_categories.id) AS num_feeds,
+                       (SELECT COUNT(id) FROM
+                               ttrss_feed_categories AS c2 WHERE
+                               c2.parent_cat = ttrss_feed_categories.id) AS num_cats
                        FROM ttrss_feed_categories
                        WHERE $nested_qpart AND owner_uid = " .
                        $_SESSION["uid"]);
@@ -141,7 +144,7 @@ class API extends Handler {
                $cats = array();
 
                while ($line = db_fetch_assoc($result)) {
-                       if ($line["num_feeds"] > 0) {
+                       if ($line["num_feeds"] > 0 || $line["num_cats"] > 0) {
                                $unread = getFeedUnread($this->link, $line["id"], true);
 
                                if ($enable_nested)