sort_comment_results: sort stickied Nones last.

pull/1/head
Snakes 2022-11-09 21:31:53 -05:00 committed by Snakes
parent ec5c0a175c
commit 86274a01b7
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 3 additions and 1 deletions

View File

@ -76,7 +76,9 @@ def sort_comment_results(sort, comments):
else:
key_func = lambda c: (c.downvotes - c.upvotes, DESC - c.created_utc)
key_func_stickied = lambda c: (c.stickied, key_func(c))
key_func_stickied = lambda c: (
(c.stickied is None, c.stickied == '', c.stickied), # sort None last
key_func(c))
return sorted(comments, key=key_func_stickied)
def make_age_string(compare:Optional[int]) -> str: