tmp fix for label counters calculation being wrong when hidden feeds are present (2)

This commit is contained in:
Andrew Dolgov 2009-01-20 09:27:13 +01:00
parent ddb0a9a80a
commit 467ff40210
1 changed files with 3 additions and 10 deletions

View File

@ -2644,22 +2644,15 @@
$owner_uid = $_SESSION["uid"]; $owner_uid = $_SESSION["uid"];
$result = db_query($link, $result = db_query($link, "SELECT id, caption FROM ttrss_labels2
"SELECT ttrss_labels2.id, caption, COUNT(unread) AS unread FROM ttrss_labels2 WHERE owner_uid = '$owner_uid'");
LEFT JOIN ttrss_user_labels2 ON (label_id = ttrss_labels2.id)
LEFT JOIN ttrss_user_entries ON (ref_id = article_id AND
unread = true AND
ttrss_user_entries.owner_uid = '$owner_uid')
LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = feed_id AND hidden = false)
WHERE ttrss_labels2.owner_uid = '$owner_uid'
GROUP BY ttrss_labels2.id, caption");
while ($line = db_fetch_assoc($result)) { while ($line = db_fetch_assoc($result)) {
$id = -$line["id"] - 11; $id = -$line["id"] - 11;
$label_name = $line["caption"]; $label_name = $line["caption"];
$count = $line["unread"]; $count = getFeedUnread($link, $id);
if (!$smart_mode || $old_counters[$id] != $count) { if (!$smart_mode || $old_counters[$id] != $count) {
$old_counters[$id] = $count; $old_counters[$id] = $count;