Open tristan-orourke opened 1 month ago
Just a heads up on this one since I ran into it previously. This is determined at the database level and we don't have much control over it at the graphql level so it might be tricky since lighthouse-php
doesn't expose this level of control.
The default behavior in postrgres is to treat null as larger than all other values so will always appear at the top of the list when sorting descending unless specified otherwise.
@esizer
Do you have any ideas for how to approach this? Table sort would also be out of the question as internal sort is false for all server-driven tables.
Yeah, I'm not sure where to go with this one either. When writing raw SQL it's easy enough to add a NULLS LAST option but since we're using the lighthouse @orderBy directive we don't have that level of control. I guess we could write a custom scope for the ordering? That seems pretty like a heavy-handed solution to a fairly minor annoyance though. I think the @orderBy also prevents us from sorting on a calculated column.
๐ Bug
Currently, when you sort Pools by Publishing Date descending, unpublished pools appear at the top, THEN recently published pools, THEN pools published a long time ago. This isn't very useful, since when sorting by published, I'm likely to want to know which ones were published most recently. All the unpublished pools get in the way of finding those.
๐ฆ Expected Behaviour
Unpublished pools (NULL date) should appear at the end of the list when sorting by publish date descending.
QUESTION: should NULLs always appear at the end of the list, whether sorting by ascending or descending?
๐ต๏ธ Details
๐ Steps to Reproduce
๐ธ Screenshot
๐โโ๏ธ Proposed Solution
โ Acceptance Criteria