add mock recommender service for development, add user-context recommended posts

This commit is contained in:
r888888888
2018-07-21 13:24:43 -07:00
parent 93c074c15b
commit 344c46ed00
20 changed files with 250 additions and 33 deletions

View File

@@ -0,0 +1,23 @@
class RecommendedPostsController < ApplicationController
before_action :member_only
respond_to :html
def show
@posts = load_posts()
if request.xhr?
render partial: "show", layout: false
end
end
private
def load_posts
if params[:context] == "post"
@posts = RecommenderService.recommend(post_id: params[:post_id])
elsif params[:context] == "user"
@posts = RecommenderService.recommend(user_id: CurrentUser.id)
end
end
end