question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default sort order for posts needs to consider status 'scheduled'

See original GitHub issue

The orderDefaultOptions() for posts model return a sort order which needs to be updated in regards of the new scheduling feature (#6861). Status quo the order is

  1. status: ‘ASC’,
  2. published_at: ‘DESC’,
  3. updated_at: ‘DESC’,
  4. id: ‘DESC’.

This worked out well so far, because we want to have posts with status ‘draft’ before posts with status ‘published’ and the usual alphabetical, ascending order (d before p) works fine.

Now, as we expanded the posts to also have a status ‘scheduled’, these posts would always be last in order, if we’d remain the regular order.

For usability reasons, ‘scheduled’ posts should be listed first. Then ‘draft’ and finally ‘published’.


I suggest to return a custom sorting function (if needed), which returns the order like this:

1. status: 1. scheduled, 2. draft, 3. published 2. published_at: ‘DESC’, 3. updated_at: ‘DESC’, 4. id: ‘DESC’

The comparison between a ‘draft’ and ‘published’ can stay the same, as the alphabetical order is valid here. Anytime a ‘scheduled’ post is compared with a different status, it should get the higher priority in the order. published_at, updated_at and id will remain unaffected.


Reason, why we have to do this:

The API endpoint is paginated so we need the server to return the posts in the right order by default or have some way to instruct the server to return posts in the order that we want.

^ thanks @kevinansfield

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
kirrg001commented, Jul 14, 2016

I will care about the ordering on the server side asap.

0reactions
awendtcommented, Jun 18, 2016

My 2 cents about the description:

For usability reasons, ‘scheduled’ posts should be listed first. Then ‘draft’ and finally ‘published’.

I don’t think this is good from a usability perspective: I’d rather see posts move down in a list from “draft” (top) to “scheduled” to “published” (bottom).

Think about it: If the UI showed scheduled first, the post starts in the middle of the list (assuming other posts are already scheduled), then moves up to scheduled, then all the way down to scheduled based on time.

I imagine this to be very confusing to users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Define a Default Feed Sort Order in Community Builder
Set a default sort order on feeds to present community members and guests with the initial experience that you intend. If users choose...
Read more >
Controlling the sort sequence used to display lists
All lists have a default sort sequence based on the type of fields present in the list.
Read more >
How to change the Default sort Order? - PracticalTek
With String Sort all characters in the string have an equal weight for sort positioning – this is the Epicor Default as shipped....
Read more >
Configurable default sort order in the Explorer? #882 - GitHub
I believe this would negate the need for a user preference: the explorer would default to showing each page listing in that section's...
Read more >
Update to default sort order for newly created pages
Based on our user learnings, we believe this new default sort order together with drag & drop page reordering in the page tree...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found