From c2406dfd6a93d9a989160cbc6907f2cb2d4a70ec Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 1 Oct 2020 18:39:33 -0700 Subject: [PATCH] lil smarter collection discovery --- app/controllers/page_collections_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index 8b9b62e3..83c2036d 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -11,10 +11,11 @@ class PageCollectionsController < ApplicationController followed_user_ids = UserFollowing.where(user_id: current_user.id).pluck(:followed_user_id) @network_collections = PageCollection.where(user_id: followed_user_ids, privacy: 'public') - - @random_collections = PageCollection.where(privacy: 'public').sample(9) - @followed_collections = current_user.followed_page_collections + + @random_collections = PageCollection.where(privacy: 'public').where.not( + id: @my_collections.pluck(:id) + @network_collections.pluck(:id) + @followed_collections.pluck(:id) + ).sample(9) end # GET /page_collections/1