Skip to content

Commit

Permalink
[optimize] Ignore blanks before and after a tag when getting random tags
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyD666 committed Dec 12, 2023
1 parent e506b77 commit 39861ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
minSdk 24
targetSdk 34
versionCode 55
versionName "2.0-alpha10"
versionName "2.0-alpha11"
flavorDimensions = ["versionName"]

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/skyd/rays/model/db/dao/TagDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ interface TagDao {
@Transaction
@Query(
"""SELECT
MIN($STICKER_UUID_COLUMN) AS $STICKER_UUID_COLUMN,
$TAG_COLUMN,
MIN($CREATE_TIME_COLUMN) AS $CREATE_TIME_COLUMN
$STICKER_UUID_COLUMN,
TRIM($TAG_COLUMN) AS $TAG_COLUMN,
$CREATE_TIME_COLUMN
FROM (SELECT * FROM $TAG_TABLE_NAME
GROUP BY $TAG_COLUMN
HAVING COUNT(*) > 2)
WHERE LENGTH($TAG_COLUMN) < 25
GROUP BY $TAG_COLUMN
GROUP BY TRIM($TAG_COLUMN)
ORDER BY RANDOM()
LIMIT :count
"""
Expand Down

0 comments on commit 39861ae

Please sign in to comment.