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

@@ -1,16 +1,10 @@
module PostSets
class Recommended < PostSets::Post
def initialize(post)
attr_reader :posts
def initialize(posts)
super("")
@post = post
end
def posts
@posts ||= begin
response = RecommenderService.similar(@post)
post_ids = response.reject {|x| x[0] == @post.id}.slice(0, 6).map {|x| x[0]}
::Post.find(post_ids)
end
@posts = posts
end
def presenter