I have a Django application in which I need to implement a simple trending/ranking algorithm. I'm very lost as a : I have two models, Book and Reader . Every night, new books are added to my database. The number of readers for each book are updated too every night i.e. One book will have multiple reader statistic records (one record for each day). Over a given period (past week, past month or past year), I would like to list the most popular books, what algorithm should I use for this? The popularity doesn't need to be realtime in any way because the reader count for each book is only updated