summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-24 14:46:45 +0400
committerAndrew Dolgov <[email protected]>2013-03-24 14:46:45 +0400
commit7be3fcd5e1fa6f8ec04fd550543b01622b5e7feb (patch)
tree96c322b68f4e536a92562e5909bc3f147c61125d /classes
parentefc6553da498bd16776cf7e88358877b1c088c7f (diff)
api, getCategories: properly return information for categories with 0 feeds, but children categories present
Diffstat (limited to 'classes')
-rw-r--r--classes/api.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/classes/api.php b/classes/api.php
index ec1219fe1..44130d397 100644
--- a/classes/api.php
+++ b/classes/api.php
@@ -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)