app/models/suggested_notebook.rb
# Don't recommend things the user is already aware of
Don't recommend things the user is already aware of
Don ' t recommend things the user is already aware of
def user_defeats(user)
      recent_views = user.clicks
        .where('updated_at > ?', 7.days.ago)
        .group(:notebook_id)
        .pluck(:notebook_id)
      owned = user.notebooks.pluck(:id)
      created = user.notebooks_created.pluck(:id)
      updated = user.notebooks_updated.pluck(:id)
      stars = user.stars.pluck(:notebook_id)
      Set.new(recent_views + owned + created + updated + stars)
    end
def user_defeats ( user ) recent_views = user . clicks . where ( 'updated_at > ?' , 7 . days . ago ) . group ( :notebook_id ) . pluck ( :notebook_id ) owned = user . notebooks . pluck ( :id ) created = user . notebooks_created . pluck ( :id ) updated = user . notebooks_updated . pluck ( :id ) stars = user . stars . pluck ( :notebook_id ) Set . new ( recent_views + owned + created + updated + stars ) end
Don't recommend things the user is already aware of
Don ' t recommend things the user is already aware of
# TODO: (?) add explicit "never show this again" option?
user