Ranking submission

The next feature on our list is ranking the submissions using an intelligent algorithm. Let's take a look at what our feature description requires:

Tip

An algorithm to rank the submitted links in some defined order that depends on a number of factors including the votes for that link, the number of comments and the age of the submission

We have all this information in our database. We need to create an algorithm that will use all these pieces of information to give each submission a rank. Then, we'll just sort the submission using this ranking and show them in the sorted order. To keep things simple, let's use the following algorithm:

rank = number of votes + number of comments – number of days since submission

Seems simple enough, ...

Get Django Project Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.