FinalsClub/djKarma

Make a ViewedFile class

Closed this issue · 2 comments

This will let us quickly generate the viewed/not viewed status of files on the course page.

fkey to:

  • user
  • course
  • file
    then when dispalying course files,

use like:

ViewedFiles.objects.filter(course=course).(fileter(user=user).all()

return list of viewedFiles ids and pass it to the template

{% if file.id in user_viewed_files %} ...

I like this idea.

As a stopgap, or improvement in other areas where we make many queries in an iterative fashion, Django's select_related function may be of use in improving performance.

@CharlesHolbrow covered this with his modification of the views.file function conditional view saving and with a karma event