Created
December 26, 2013 01:12
How V2EX decides topic order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logic to decide how this reply affects ranking of the topic | |
now = self.now() | |
diff = now - topic.last_touched | |
if topic.last_touched < now: | |
if topic.old_topic: | |
if diff > 86400: | |
topic.last_touched = topic.last_touched + int(diff / 8) | |
else: | |
if diff > (3600 * 4): | |
topic.last_touched = topic.last_touched + 3600 | |
else: | |
if diff < 3600: | |
topic.last_touched = now | |
else: | |
topic.last_touched = topic.last_touched + 600 | |
else: | |
if diff > 86400: | |
topic.last_touched = topic.last_touched + int(diff / 4) | |
else: | |
if diff > (3600 * 4): | |
topic.last_touched = topic.last_touched + 3600 | |
else: | |
topic.last_touched = now | |
else: | |
# Extension: 60s to sticky topic | |
topic.last_touched = topic.last_touched + 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment