Reader: order articles within a group newest-first #19
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Articles inside a group / aggregate are not ordered by recency, so the newest articles in a group do not reliably sit at the top of the reader.
Goal
Findings
COALESCE(updated, created)desc — to be confirmed against the schema.Plan of attack
Design note (corrects the findings comment)
The findings proposed ordering by
COALESCE(updated, created)— but the schema check shows articles have noupdated_atcolumn (onlyaggregatesandfeedsdo). The recency fields onarticlesarepublished_at(nullable) andcreated_at(fetch time, NOT NULL).Design:
get_articles_in_aggregatejoins toarticlesand orders byCOALESCE(published_at, created_at) DESC, created_at DESC— matching the house precedent in the other article-list queries (published_at DESC NULLS LAST, created_at DESC). Articles without a publish date sort by fetch time; ties break on fetch time. This also fixes the featured-image choice on the reader index, which takes the first article's image — it will now feature the newest article's image.Resolved by PR (merged):
get_articles_in_aggregatenow orders byCOALESCE(published_at, created_at) DESC, created_at DESC, article_id DESC— newest first, with deterministic tie-breaking.