fix(collections): the order select re-orders the PAGE — visible order = play order
The detail header's listening-order select persisted fine and the reader chain honored it, but the page's card list never applied chain_order (it kept the composed query's title order) — so flipping the select changed nothing visible, and Play as Sequence launches from the FIRST CARD ON THE PAGE, making the played start (and the perceived order) disagree with the curated setting (2026-11-01 user report on the smart podcast page). - Smart episode collections: the page's match list re-orders through OrderEpisodeMedia (the same OrderEpisodes comparator the sequence producer uses — §10 R2's single source of order truth) before card building. Books-scope matches keep title order. - Static episode playlists: the sequence now honors the curated order too — native keeps the manual position order (SQL), reverse flips it, oldest/newest re-key on publication date with feed position as tiebreak. Previously statics ignored chain_order entirely while the select rendered on their pages. Pins: native page order (feed positions) and the reverse flip re-ordering the SSR cards, asserted in the curated-order subtest alongside the existing reader-chain pins. Podcast/playlist/audiobook/ RLS/dashboard/contract slices green.
This commit is contained in:
1 parent
178b1f30c5
commit
81e54f89b2
4 files changed
+77
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"bookhoard/internal/database"
|
||||
"fmt"
|
||||
"sort"
|
||||
)
|
||||
@@ -53,6 +54,32 @@ func OrderEpisodes[T any](eps []T, order string, pos func(T) int32, date func(T)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderEpisodeMedia applies the curated listening order to a media
|
||||
// match list — the SMART collection page renders exactly what the
|
||||
// sequence will play (2026-11-01 user report: flipping the order select
|
||||
// changed nothing on the page, and Play launches from the first card).
|
||||
// Non-episode match lists are left untouched (title order stays).
|
||||
func OrderEpisodeMedia(items []database.MediaItems, order string) {
|
||||
anyEpisode := false
|
||||
for _, m := range items {
|
||||
if m.Source == "podcast_episode" {
|
||||
anyEpisode = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !anyEpisode {
|
||||
return
|
||||
}
|
||||
OrderEpisodes(items, order,
|
||||
func(m database.MediaItems) int32 { return m.FeedPosition.Int32 },
|
||||
func(m database.MediaItems) string {
|
||||
if m.DatePublished.Valid {
|
||||
return m.DatePublished.Time.Format("2006-01-02")
|
||||
}
|
||||
return ""
|
||||
})
|
||||
}
|
||||
|
||||
// episodePosKey: zero-padded position so lexical date keys tiebreak
|
||||
// numerically.
|
||||
func episodePosKey(pos int32) string {
|
||||
|
||||
Reference in new issue
Block a user