From 41fffaa56d784307ff7c84bdb7011eea41a4a6ca Mon Sep 17 00:00:00 2001 From: Caio <117518+caiosba@users.noreply.github.com> Date: Mon, 16 Dec 2024 23:00:00 -0300 Subject: [PATCH] Ticket CV2-5836: Use top_media_tags for... the top_media_tags method --- lib/team_statistics.rb | 2 +- test/lib/team_statistics_test.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/team_statistics.rb b/lib/team_statistics.rb index b7a0b8f7a..4c58dedfe 100644 --- a/lib/team_statistics.rb +++ b/lib/team_statistics.rb @@ -198,7 +198,7 @@ def top_requested_media_clusters # FIXME: The "demand" is across languages and platforms def top_media_tags tags = {} - clusters = CheckDataPoints.top_clusters(@team.id, @start_date, @end_date, 5, 'last_seen', @language || @all_languages, 'language', @platform) + clusters = CheckDataPoints.top_media_tags(@team.id, @start_date, @end_date, 20, 'last_seen', @language || @all_languages, 'language', @platform) clusters.each do |pm_id, demand| item = ProjectMedia.find(pm_id) item.tags_as_sentence.split(',').map(&:strip).each do |tag| diff --git a/test/lib/team_statistics_test.rb b/test/lib/team_statistics_test.rb index ca164c628..6e3d7744f 100644 --- a/test/lib/team_statistics_test.rb +++ b/test/lib/team_statistics_test.rb @@ -2,6 +2,7 @@ class TeamStatisticsTest < ActiveSupport::TestCase def setup + Explainer.delete_all @team = create_team @team.set_languages = ['en', 'pt'] @team.save! @@ -52,7 +53,7 @@ def teardown create_fact_check(tags: ['foo', 'bar'], language: 'en', rating: 'false', claim_description: create_claim_description(project_media: create_project_media(team: @team))) create_fact_check(tags: ['foo', 'bar'], claim_description: create_claim_description(project_media: create_project_media(team: team))) exp = create_explainer team: @team, language: 'en', tags: ['foo'] - create_explainer team: @team, tags: ['foo', 'bar'] + create_explainer team: @team, tags: ['foo', 'bar'], language: 'pt' create_explainer language: 'en', team: team, tags: ['foo', 'bar'] end @@ -60,7 +61,7 @@ def teardown create_fact_check(tags: ['bar'], report_status: 'published', rating: 'verified', language: 'en', claim_description: create_claim_description(project_media: create_project_media(team: @team))) create_fact_check(tags: ['foo', 'bar'], claim_description: create_claim_description(project_media: create_project_media(team: team))) create_explainer team: @team, language: 'en', tags: ['foo'] - create_explainer team: @team, tags: ['foo', 'bar'] + create_explainer team: @team, tags: ['foo', 'bar'], language: 'pt' create_explainer language: 'en', team: team, tags: ['foo', 'bar'] exp.updated_at = Time.now exp.save!