#73: fix track sorting order by fixing a mistake and taking disc_number into consideration.
This commit is contained in:
parent
9beb5e6641
commit
4cf77404a1
|
@ -13,7 +13,7 @@ import java.io.BufferedReader
|
|||
|
||||
class TracksRepository(override val context: Context?, albumId: Int) : Repository<Track, TracksCache>() {
|
||||
override val cacheId = "tracks-album-$albumId"
|
||||
override val upstream = HttpUpstream<Track, OtterResponse<Track>>(HttpUpstream.Behavior.AtOnce, "/api/v1/tracks/?playable=true&album=$albumId", object : TypeToken<TracksResponse>() {}.type)
|
||||
override val upstream = HttpUpstream<Track, OtterResponse<Track>>(HttpUpstream.Behavior.AtOnce, "/api/v1/tracks/?playable=true&album=$albumId&ordering=disc_number,position", object : TypeToken<TracksResponse>() {}.type)
|
||||
|
||||
override fun cache(data: List<Track>) = TracksCache(data)
|
||||
override fun uncache(reader: BufferedReader) = gsonDeserializerOf(TracksCache::class.java).deserialize(reader)
|
||||
|
@ -56,6 +56,6 @@ class TracksRepository(override val context: Context?, albumId: Int) : Repositor
|
|||
}
|
||||
|
||||
track
|
||||
}.sortedBy { it.position }
|
||||
}.sortedWith(compareBy({ it.disc_number }, { it.position }))
|
||||
}
|
||||
}
|
|
@ -101,6 +101,7 @@ data class Track(
|
|||
val title: String,
|
||||
val artist: Artist,
|
||||
val album: Album?,
|
||||
val disc_number: Int = 0,
|
||||
val position: Int = 0,
|
||||
val uploads: List<Upload> = listOf(),
|
||||
val copyright: String? = null,
|
||||
|
|
Loading…
Reference in New Issue