bug fixes + tests
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
module PostSets
|
||||
class Similar < PostSets::Post
|
||||
def initialize(post)
|
||||
super(tags)
|
||||
super("")
|
||||
@post = post
|
||||
end
|
||||
|
||||
def posts
|
||||
@posts ||= begin
|
||||
post_ids, scores = RecommenderService.similar(post)
|
||||
post_ids = post_ids.reject {|x| x == post.id}.slice(0, 5)
|
||||
Post.find(post_ids)
|
||||
response = RecommenderService.similar(@post)
|
||||
post_ids = response.reject {|x| x[0] == @post.id}.slice(0, 5).map {|x| x[0]}
|
||||
::Post.find(post_ids)
|
||||
end
|
||||
end
|
||||
|
||||
def presenter
|
||||
::Presenters::PostSetPresenters::Post.new(self)
|
||||
::PostSetPresenters::Post.new(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user