[deploy] Refactor: Remove Unused Article Suggester Services and Specs (#9031)

This commit is contained in:
Molly Struve 2020-06-30 12:06:56 -05:00 committed by GitHub
parent 336cf119d9
commit 9d18246875
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 64 deletions

View file

@ -1,27 +0,0 @@
module Suggester
module Articles
class Boosted
attr_accessor :tag, :not_ids, :area
def initialize(tag, options)
@tag = tag
@not_ids = options[:not_ids]
@area = options[:area]
end
def suggest
base_articles = Article.
includes(:user, :organization).
where.not(id: not_ids).
where.not(organization_id: nil).
cached_tagged_with(tag)
if area == "additional_articles"
base_articles.boosted_via_additional_articles.sample
else
base_articles.boosted_via_dev_digest_email.sample
end
end
end
end
end

View file

@ -1,21 +0,0 @@
module Suggester
module Articles
class HighQuality
MIN_HQ_REACTION_COUNT = Rails.env.production? ? 75 : 1
def initialize(options = {})
@not_ids = options[:not_ids]
end
def suggest(num)
Article.published.where(featured: true).
includes(:user).
limited_column_select.
where("public_reactions_count > ?", MIN_HQ_REACTION_COUNT).
where.not(id: @not_ids).
order(Arel.sql("RANDOM()")).
limit(num)
end
end
end
end

View file

@ -1,16 +0,0 @@
require "rails_helper"
RSpec.describe Suggester::Articles::Boosted, type: :service do
let(:user) { create(:user) }
let(:organization) { create(:organization) }
let(:tag) { create(:tag, supported: true) }
let(:article) { create(:article, tags: [tag.name], featured: true) }
let(:reaction) { create(:reaction, user_id: user.id, reactable: article) }
it "returns an article" do
user.follow(tag)
article2 = create(:article, tags: [tag.name], featured: true, boosted_additional_articles: true, organization_id: organization.id)
suggested_id = described_class.new(tag.name, area: "additional_articles").suggest.id
expect(suggested_id).to eq article2.id
end
end