Made the due distinction based on the server on the most listened to songs of the week

This commit is contained in:
antonio 2023-01-06 18:30:07 +01:00
parent 5eed437c5b
commit 1204716a65
6 changed files with 29 additions and 14 deletions

View file

@ -23,13 +23,11 @@ import com.cappielloantonio.play.model.Server;
@SuppressLint("RestrictedApi")
@Database(
version = 42,
version = 43,
entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Playlist.class, Chronology.class},
autoMigrations = {@AutoMigration(from = 41, to = 42)}
autoMigrations = {@AutoMigration(from = 42, to = 43)}
)
public abstract class AppDatabase extends RoomDatabase {
private static final String TAG = "AppDatabase";
private final static String DB_NAME = "play_db";
private static AppDatabase instance;

View file

@ -12,8 +12,8 @@ import java.util.List;
@Dao
public interface ChronologyDao {
@Query("SELECT * FROM chronology WHERE timestamp >= :startDate AND timestamp < :endDate GROUP BY id ORDER BY COUNT(id) DESC LIMIT 9")
LiveData<List<Chronology>> getAllFrom(long startDate, long endDate);
@Query("SELECT * FROM chronology WHERE timestamp >= :startDate AND timestamp < :endDate AND server == :server GROUP BY id ORDER BY COUNT(id) DESC LIMIT 9")
LiveData<List<Chronology>> getAllFrom(long startDate, long endDate, String server);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(Chronology chronologyObject);