Skip to content

Commit

Permalink
Fix tags suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Koitharu committed Jul 28, 2023
1 parent 694297f commit 50554c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 7 additions & 4 deletions app/src/main/kotlin/org/koitharu/kotatsu/core/db/dao/TagsDao.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.koitharu.kotatsu.core.db.dao

import androidx.room.*
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Upsert
import org.koitharu.kotatsu.core.db.entity.TagEntity

@Dao
Expand All @@ -12,6 +14,7 @@ abstract class TagsDao {
@Query(
"""SELECT tags.* FROM tags
LEFT JOIN manga_tags ON tags.tag_id = manga_tags.tag_id
WHERE manga_tags.manga_id IN (SELECT manga_id FROM history UNION SELECT manga_id FROM favourites)
GROUP BY tags.title
ORDER BY COUNT(manga_id) DESC
LIMIT :limit""",
Expand All @@ -21,7 +24,7 @@ abstract class TagsDao {
@Query(
"""SELECT tags.* FROM tags
LEFT JOIN manga_tags ON tags.tag_id = manga_tags.tag_id
WHERE tags.source = :source
WHERE tags.source = :source
GROUP BY tags.title
ORDER BY COUNT(manga_id) DESC
LIMIT :limit""",
Expand All @@ -31,7 +34,7 @@ abstract class TagsDao {
@Query(
"""SELECT tags.* FROM tags
LEFT JOIN manga_tags ON tags.tag_id = manga_tags.tag_id
WHERE tags.source = :source AND title LIKE :query
WHERE tags.source = :source AND title LIKE :query
GROUP BY tags.title
ORDER BY COUNT(manga_id) DESC
LIMIT :limit""",
Expand All @@ -41,7 +44,7 @@ abstract class TagsDao {
@Query(
"""SELECT tags.* FROM tags
LEFT JOIN manga_tags ON tags.tag_id = manga_tags.tag_id
WHERE title LIKE :query
WHERE title LIKE :query AND manga_tags.manga_id IN (SELECT manga_id FROM history UNION SELECT manga_id FROM favourites)
GROUP BY tags.title
ORDER BY COUNT(manga_id) DESC
LIMIT :limit""",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ class SelectableTextView @JvmOverloads constructor(
}

override fun scrollTo(x: Int, y: Int) {
if (maxLines in 1 until Integer.MAX_VALUE) {
super.scrollTo(0, 0)
} else {
super.scrollTo(x, y)
}
super.scrollTo(0, 0)
}
}

0 comments on commit 50554c6

Please sign in to comment.