Fix invalid order of school announcements (#1689)

This commit is contained in:
Michael 2021-12-11 17:35:55 +01:00 committed by GitHub
parent 79b970256f
commit c87085a226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -10,6 +10,6 @@ import javax.inject.Singleton
@Singleton @Singleton
interface SchoolAnnouncementDao : BaseDao<SchoolAnnouncement> { interface SchoolAnnouncementDao : BaseDao<SchoolAnnouncement> {
@Query("SELECT * FROM SchoolAnnouncements WHERE student_id = :studentId") @Query("SELECT * FROM SchoolAnnouncements WHERE student_id = :studentId ORDER BY date DESC")
fun loadAll(studentId: Int): Flow<List<SchoolAnnouncement>> fun loadAll(studentId: Int): Flow<List<SchoolAnnouncement>>
} }

View File

@ -74,7 +74,7 @@ class SchoolAnnouncementPresenter @Inject constructor(
Status.SUCCESS -> { Status.SUCCESS -> {
Timber.i("Loading School announcement result: Success") Timber.i("Loading School announcement result: Success")
view?.apply { view?.apply {
updateData(it.data!!.sortedByDescending { item -> item.date }) updateData(it.data!!)
showEmpty(it.data.isEmpty()) showEmpty(it.data.isEmpty())
showErrorView(false) showErrorView(false)
showContent(it.data.isNotEmpty()) showContent(it.data.isNotEmpty())