ᕕ( ᐛ )ᕗ Herman's blog

Auto upvote

All posts are now auto toasted (upvoted) by the publishing user. Toasts are used to rank the posts on the discovery feed.

This does a few things:

  • It removes the discrepancy between people who upvote their own posts, and those who do not.
  • Having a single toast will (for a time) put the newest post at the top of the trending page, giving it an equal time opportunity to be discovered.
  • Toasts which do then not receive additional toasts while on the Trending page will move down the page over a period of time according to gravity (currently 1.2).

If you're curious about the actual implementation of this algorithm you can check it out at the bottom of the discovery feed, and the actual code for it:

posts = Post.objects.annotate(
            upvote_count=Count('upvote'),
            score=ExpressionWrapper(
                ((Count('upvote')) / ((Seconds(Now() - F('published_date')))+2)**gravity)*100000,
                output_field=FloatField()
            ),
        ).filter(publish=True, show_in_feed=True, published_date__lte=timezone.now()
                 ).order_by('-score', '-published_date'
                            ).select_related('blog').prefetch_related('upvote_set')[posts_from:posts_to]

#bearblog

- 29 toasts