forked from MarseyWorld/MarseyWorld
master
parent
4d2d789142
commit
710308dd00
|
@ -47,6 +47,8 @@ def sort_objects(sort, objects, cls):
|
||||||
return objects.order_by(cls.created_utc.desc())
|
return objects.order_by(cls.created_utc.desc())
|
||||||
elif sort == "old":
|
elif sort == "old":
|
||||||
return objects.order_by(cls.created_utc)
|
return objects.order_by(cls.created_utc)
|
||||||
|
elif sort == "controversial" and cls.__name__ == "Submission":
|
||||||
|
return objects.order_by((cls.upvotes+1)/(cls.downvotes+1) + (cls.downvotes+1)/(cls.upvotes+1) - cls.comment_count/500, cls.downvotes.desc(), cls.created_utc.desc())
|
||||||
elif sort == "controversial":
|
elif sort == "controversial":
|
||||||
return objects.order_by((cls.upvotes+1)/(cls.downvotes+1) + (cls.downvotes+1)/(cls.upvotes+1), cls.downvotes.desc(), cls.created_utc.desc())
|
return objects.order_by((cls.upvotes+1)/(cls.downvotes+1) + (cls.downvotes+1)/(cls.upvotes+1), cls.downvotes.desc(), cls.created_utc.desc())
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
|
|
Loading…
Reference in New Issue