i want to make a rank application, that will calculate the rank of each course uploaded on a platform. Is it a good approach to have stored in a table values like number of downloads, and number of views, like that?
class Courserate(models.Model):
course = models.ForeignKey(Courses)
downloads = models.IntegerField(editable = False, default = 0)
views = models.IntegerField(editable = False, default = 0)
positive_votes = models.IntegerField(editable = False, default = 0)
negative_votes = models.IntegerField(editable = False, default = 0)
also, when i'm trying to take the number of downloads, for example, for a course belonging to a specific classroom, how should i do it? I mean, a quesry like:
courses = Courses.objects.filter(classroom = userclass)
downloads = Courserate.objects.filter(course = courses).downloads
the downloads query doesn't work, how can i 'take' the number of downloads for each course?