Skip to content

Commit eb67492

Browse files
committed
update: most played parameters #58
1 parent acfe3fe commit eb67492

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

  • repository/src/main/java/app/simple/felicity/repository/database/dao

repository/src/main/java/app/simple/felicity/repository/database/dao/SongStatDao.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface SongStatDao {
4949
fun getMostPlayedAudio(): Flow<List<Audio>>
5050

5151
/**
52-
* Returns up to 50 available songs with their stat data ordered by last-played
52+
* Returns available songs with their stat data ordered by last-played
5353
* timestamp descending. All stat columns — including {@code skipCount} and
5454
* {@code replayCount} — are pulled in from the join so callers get the full picture.
5555
*/
@@ -58,46 +58,45 @@ interface SongStatDao {
5858
INNER JOIN song_stats ss ON a.hash = ss.audioHash
5959
WHERE a.is_available = 1 AND ss.lastPlayed > 0
6060
ORDER BY ss.lastPlayed DESC
61-
LIMIT 50
6261
""")
6362
fun getRecentlyPlayedWithStat(): Flow<List<AudioWithStat>>
6463

6564
/**
66-
* Returns up to 50 available songs with their stat data ordered by play count
65+
* Returns available songs with their stat data ordered by play count
6766
* descending. All stat columns — including {@code skipCount} and {@code replayCount}
6867
* — are pulled in from the join so callers get the full picture.
68+
*
69+
* Only returns songs played atlease twice to ensure the list is meaningful and
70+
* not cluttered with one-off plays.
6971
*/
7072
@Query("""
7173
SELECT a.*, ss.lastPlayed, ss.playCount, ss.skipCount, ss.replayCount FROM audio a
7274
INNER JOIN song_stats ss ON a.hash = ss.audioHash
73-
WHERE a.is_available = 1 AND ss.playCount > 0
75+
WHERE a.is_available = 1 AND ss.playCount > 1
7476
ORDER BY ss.playCount DESC
75-
LIMIT 50
7677
""")
7778
fun getMostPlayedWithStat(): Flow<List<AudioWithStat>>
7879

7980
/**
80-
* Returns up to 50 available songs ordered by their total skip count, highest first.
81+
* Returns available songs ordered by their total skip count, highest first.
8182
*/
8283
@Query("""
8384
SELECT a.* FROM audio a
8485
INNER JOIN song_stats ss ON a.hash = ss.audioHash
8586
WHERE a.is_available = 1 AND ss.skipCount > 0
8687
ORDER BY ss.skipCount DESC
87-
LIMIT 50
8888
""")
8989
fun getMostSkippedAudio(): Flow<List<Audio>>
9090

9191
/**
92-
* Returns up to 50 available songs with their stat data ordered by skip count
92+
* Returns available songs with their stat data ordered by skip count
9393
* descending, so the UI can show how many times each song was skipped.
9494
*/
9595
@Query("""
9696
SELECT a.*, ss.lastPlayed, ss.playCount, ss.skipCount, ss.replayCount FROM audio a
9797
INNER JOIN song_stats ss ON a.hash = ss.audioHash
9898
WHERE a.is_available = 1 AND ss.skipCount > 0
9999
ORDER BY ss.skipCount DESC
100-
LIMIT 50
101100
""")
102101
fun getMostSkippedWithStat(): Flow<List<AudioWithStat>>
103102

0 commit comments

Comments
 (0)