Fix last week's top songs

This commit is contained in:
antonio 2023-03-19 20:14:39 +01:00
parent cbeceee81a
commit 0512cf036e

View file

@ -72,18 +72,8 @@ public class HomeViewModel extends AndroidViewModel {
} }
public LiveData<List<Chronology>> getGridSongSample(LifecycleOwner owner) { public LiveData<List<Chronology>> getGridSongSample(LifecycleOwner owner) {
Calendar cal = Calendar.getInstance();
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
String server = Preferences.getServerId(); String server = Preferences.getServerId();
chronologyRepository.getLastWeek(server).observe(owner, thisGridTopSong::postValue);
if (thisGridTopSong.getValue() == null) {
if (dayOfMonth >= 7) {
chronologyRepository.getThisWeek(server).observe(owner, thisGridTopSong::postValue);
} else {
chronologyRepository.getLastWeek(server).observe(owner, thisGridTopSong::postValue);
}
}
return thisGridTopSong; return thisGridTopSong;
} }