sort_comment_results: sort stickied Nones last.
parent
ec5c0a175c
commit
86274a01b7
|
@ -76,7 +76,9 @@ def sort_comment_results(sort, comments):
|
||||||
else:
|
else:
|
||||||
key_func = lambda c: (c.downvotes - c.upvotes, DESC - c.created_utc)
|
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)
|
return sorted(comments, key=key_func_stickied)
|
||||||
|
|
||||||
def make_age_string(compare:Optional[int]) -> str:
|
def make_age_string(compare:Optional[int]) -> str:
|
||||||
|
|
Loading…
Reference in New Issue