diff --git a/app/assets/stylesheets/specific/posts.scss b/app/assets/stylesheets/specific/posts.scss index ec0d180e5..97e3ff1ad 100644 --- a/app/assets/stylesheets/specific/posts.scss +++ b/app/assets/stylesheets/specific/posts.scss @@ -324,6 +324,10 @@ div#c-posts { font-weight: bold; } + .similar-posts { + margin-top: 1em; + } + #add-fav-button, #remove-fav-button { margin-top: 1em; } diff --git a/app/logical/post_sets/similar.rb b/app/logical/post_sets/similar.rb index 65ab49c85..b41166f94 100644 --- a/app/logical/post_sets/similar.rb +++ b/app/logical/post_sets/similar.rb @@ -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 diff --git a/app/views/posts/partials/index/_similar.html.erb b/app/views/posts/partials/index/_similar.html.erb index ab2b750df..5f068dfd3 100644 --- a/app/views/posts/partials/index/_similar.html.erb +++ b/app/views/posts/partials/index/_similar.html.erb @@ -1,7 +1,7 @@ -
You might also like:
+You might also like:
-