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!