Skip to content

Commit

Permalink
Delete the set_cluster method definition and calls from Alegre Bot
Browse files Browse the repository at this point in the history
For FactsFirstPH, elections project we run in the Philippines in early 2022, we implemented the very first version of shared feeds and global clusters. Part of that logic included adding new items to clusters automatically. We’re changing this logic, so before proceeding with the new logic, it’s important to get rid of the previous one.
  • Loading branch information
jayjay-w committed Jan 25, 2024
1 parent ea0eb3f commit 57d0672
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
5 changes: 0 additions & 5 deletions lib/tasks/check_clusters.rake
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ namespace :check do
team = Team.find_by_slug(slug)
n = ProjectMedia.where(team_id: team.id).count
i = 0
ProjectMedia.where(team_id: team.id).order('id ASC').find_each do |pm|
i += 1
c = Bot::Alegre.set_cluster(pm, true)
log "[#{i}/#{n}] [#{Time.now}] Adding item #{pm.id} to the clusters... added to cluster #{c.id}"
end
end
end
end
4 changes: 0 additions & 4 deletions test/models/bot/alegre_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -673,14 +673,10 @@ def teardown

ProjectMedia.any_instance.stubs(:similar_items_ids_and_scores).returns({ pm1.id => { score: 0.9 }, pm2.id => { score: 0.8 } })
pm3 = create_project_media team: @team
Bot::Alegre.set_cluster(pm3)
assert_equal c1.id, pm3.reload.cluster_id

ProjectMedia.any_instance.stubs(:similar_items_ids_and_scores).returns({})
pm4 = create_project_media team: @team
assert_difference 'Cluster.count' do
Bot::Alegre.set_cluster(pm4)
end

ProjectMedia.any_instance.unstub(:similar_items_ids_and_scores)
end
Expand Down
11 changes: 0 additions & 11 deletions test/models/cluster_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,6 @@ def setup
end
end

test "should set cluster" do
t = create_team
pm1 = create_project_media team: t
c = create_cluster
c.project_medias << pm1
pm2 = create_project_media team: t
ProjectMedia.any_instance.stubs(:similar_items_ids_and_scores).returns({ pm1.id => { score: 0.9, context: {} }, random_number => { score: 0.8, context: { foo: 'bar' } } })
assert_equal c, Bot::Alegre.set_cluster(pm2)
ProjectMedia.any_instance.unstub(:similar_items_ids_and_scores)
end

test "should get requests count" do
create_annotation_type_and_fields('Smooch', { 'Data' => ['JSON', true] })
RequestStore.store[:skip_cached_field_update] = false
Expand Down

0 comments on commit 57d0672

Please sign in to comment.