mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Fix last week's top songs
This commit is contained in:
parent
cbeceee81a
commit
0512cf036e
1 changed files with 1 additions and 11 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue