diff --git a/storage/category.go b/storage/category.go index 8c2ce734..ccf61988 100644 --- a/storage/category.go +++ b/storage/category.go @@ -122,11 +122,13 @@ func (s *Storage) CategoriesWithFeedCount(userID int64) (model.Categories, error (SELECT count(*) FROM feeds JOIN entries ON (feeds.id = entries.feed_id) - WHERE feeds.category_id = c.id AND entries.status = 'unread') + WHERE feeds.category_id = c.id AND entries.status = 'unread') AS count_unread FROM categories c WHERE user_id=$1 - ORDER BY c.title ASC + ORDER BY + count_unread DESC, + c.title ASC ` rows, err := s.db.Query(query, userID) diff --git a/template/templates/views/categories.html b/template/templates/views/categories.html index 8e593474..41610bb5 100644 --- a/template/templates/views/categories.html +++ b/template/templates/views/categories.html @@ -15,7 +15,7 @@ {{ else }}