{"action":"created","issue":{"url":"https://api.github.com/repos/miniflux/miniflux/issues/456","labels_url":"https://api.github.com/repos/miniflux/miniflux/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/miniflux/miniflux/issues/456/comments","events_url":"https://api.github.com/repos/miniflux/miniflux/issues/456/events","html_url":"https://github.com/miniflux/miniflux/issues/456","id":122388753,"number":456,"title":"Failed and disabled feed at the top","user":{"login":"Groggy1","id":2741659,"avatar_url":"https://avatars.githubusercontent.com/u/2741659?v=3","gravatar_id":"","url":"https://api.github.com/users/Groggy1","html_url":"https://github.com/Groggy1","followers_url":"https://api.github.com/users/Groggy1/followers","following_url":"https://api.github.com/users/Groggy1/following{/other_user}","gists_url":"https://api.github.com/users/Groggy1/gists{/gist_id}","starred_url":"https://api.github.com/users/Groggy1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Groggy1/subscriptions","organizations_url":"https://api.github.com/users/Groggy1/orgs","repos_url":"https://api.github.com/users/Groggy1/repos","events_url":"https://api.github.com/users/Groggy1/events{/privacy}","received_events_url":"https://api.github.com/users/Groggy1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-15T23:04:47Z","updated_at":"2015-12-16T20:01:54Z","closed_at":null,"body":"Hi!\r\nIf a failed feed is disabled from the \"Edit subscription\" tab, the feed will continue to be at the top with the red warning stating\r\n\r\n>An error occurred during the last check. Refresh the feed manually and check the console for errors afterwards!\r\n\r\nI have looked on a more \"correct\" behavior according to me. That would be that the error isn't displayed and the feed is at the bottom with the other feeds that are disabled. In order to achieve this behavior two functions were modified in the ```models/feeds.php``` file.\r\n\r\n```\r\nfunction count_failed_feeds()\r\n{\r\n    return Database::getInstance('db')\r\n        ->table('feeds')\r\n        ->eq('parsing_error', '1')\r\n        ->count();\r\n}\r\n```\r\nwould be changed to\r\n```\r\nfunction count_failed_feeds()\r\n{\r\n    return Database::getInstance('db')\r\n        ->table('feeds')\r\n        ->eq('parsing_error', '1')\r\n        ->eq('enabled', 1)\r\n        ->count();\r\n}\r\n```\r\nin order to remove the warning if no active feed has an error. Note that I don't know if chaining two (or more) eq() after each other  can be done without complications.\r\n\r\nTo move down the disabled feeds with an error can\r\n```\r\nfunction get_all_item_counts()\r\n{\r\n    return Database::getInstance('db')\r\n        ->table('feeds')\r\n        ->columns(\r\n            'feeds.*',\r\n            'SUM(CASE WHEN items.status IN (\"unread\") THEN 1 ELSE 0 END) as \"items_unread\"',\r\n            'SUM(CASE WHEN items.status IN (\"read\", \"unread\") THEN 1 ELSE 0 END) as \"items_total\"'\r\n          )\r\n        ->join('items', 'feed_id', 'id')\r\n        ->groupBy('feeds.id')\r\n        ->desc('feeds.parsing_error')\r\n        ->desc('feeds.enabled')\r\n        ->asc('feeds.title')\r\n        ->findAll();\r\n}\r\n```\r\nbe changed to\r\n```\r\nfunction get_all_item_counts()\r\n{\r\n    return Database::getInstance('db')\r\n        ->table('feeds')\r\n        ->columns(\r\n            'feeds.*',\r\n            'SUM(CASE WHEN items.status IN (\"unread\") THEN 1 ELSE 0 END) as \"items_unread\"',\r\n            'SUM(CASE WHEN items.status IN (\"read\", \"unread\") THEN 1 ELSE 0 END) as \"items_total\"'\r\n          )\r\n        ->join('items', 'feed_id', 'id')\r\n        ->groupBy('feeds.id')\r\n        ->desc('feeds.enabled')\r\n        ->desc('feeds.parsing_error')\r\n        ->asc('feeds.title')\r\n        ->findAll();\r\n}\r\n```\r\nThis results in an order of failed and active feeds, active and working feeds, failed and disabled feeds, disabled feeds.\r\n\r\nThe changes are subtle to the code and doesn't change the function of the reader in a major way. The changes are made on an self-hosted installation with version 1.1.8. As I don't know how to do a PR did I post this as an Issue although it might be more suitable as an PR."},"comment":{"url":"https://api.github.com/repos/miniflux/miniflux/issues/comments/165229523","html_url":"https://github.com/miniflux/miniflux/issues/456#issuecomment-165229523","issue_url":"https://api.github.com/repos/miniflux/miniflux/issues/456","id":165229523,"user":{"login":"mkresin","id":4547948,"avatar_url":"https://avatars.githubusercontent.com/u/4547948?v=3","gravatar_id":"","url":"https://api.github.com/users/mkresin","html_url":"https://github.com/mkresin","followers_url":"https://api.github.com/users/mkresin/followers","following_url":"https://api.github.com/users/mkresin/following{/other_user}","gists_url":"https://api.github.com/users/mkresin/gists{/gist_id}","starred_url":"https://api.github.com/users/mkresin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkresin/subscriptions","organizations_url":"https://api.github.com/users/mkresin/orgs","repos_url":"https://api.github.com/users/mkresin/repos","events_url":"https://api.github.com/users/mkresin/events{/privacy}","received_events_url":"https://api.github.com/users/mkresin/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T20:01:54Z","updated_at":"2015-12-16T20:01:54Z","body":"@Groggy1 Please have a look at #457. The PR should prevent such situations in future."}}