data: allows to retrieve most unread tags from database
authorDa Risk <da_risk@geekorum.com>
Fri, 15 May 2020 16:58:27 -0400
changeset 675 3b1c8ed2b014
parent 674 825fa5987f3c
child 676 1b1fa9f1c117
data: allows to retrieve most unread tags from database
app/src/main/java/com/geekorum/ttrss/data/ArticleDao.kt
--- a/app/src/main/java/com/geekorum/ttrss/data/ArticleDao.kt	Sat May 09 22:38:05 2020 -0400
+++ b/app/src/main/java/com/geekorum/ttrss/data/ArticleDao.kt	Fri May 15 16:58:27 2020 -0400
@@ -96,4 +96,13 @@
         + "WHERE ArticleFTS MATCH :query "
         + "ORDER BY last_time_update DESC")
     fun searchArticles(query: String?): DataSource.Factory<Int, Article>
+
+    @Query("SELECT tag  FROM articles_tags " +
+        " JOIN articles ON (articles_tags.article_id = articles._id)" +
+        " WHERE articles.unread=1" +
+        " GROUP BY tag" +
+        " ORDER BY COUNT(article_id) DESC" +
+        " LIMIT :count ")
+    suspend fun getMostUnreadTags(count: Int): List<String>
+
 }