Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface questions over a given threshold #216

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zealchen
Copy link

@zealchen zealchen commented Jan 10, 2025

Proposed fix for #212.

Adding a top n sort function for all questions. The top votes which are unanswered and not hidden will be ranked first.
And the rest are sorted by the current hotness score.

@zealchen zealchen changed the title add top n sort by votes Surface questions over a given threshold Jan 13, 2025
@jonhoo
Copy link
Owner

jonhoo commented Jan 21, 2025

I think you should be able to do this more easily by first partitioning by answered||hidden, then sorting by votes, then using split_at to grab the first N, then sorting the tail by score, and then concatenating. Should save you all the custom Ord stuff!

@zealchen
Copy link
Author

I think you should be able to do this more easily by first partitioning by answered||hidden, then sorting by votes, then using split_at to grab the first N, then sorting the tail by score, and then concatenating. Should save you all the custom Ord stuff!

Yes! This can be more concise. I have just refactored the code accordingly. Thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants