Skip to content

Commit

Permalink
Ticket CV2-5836: Use top_media_tags for... the top_media_tags method
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Dec 17, 2024
1 parent 00f1dd0 commit 41fffaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/team_statistics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
5 changes: 3 additions & 2 deletions test/lib/team_statistics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class TeamStatisticsTest < ActiveSupport::TestCase
def setup
Explainer.delete_all
@team = create_team
@team.set_languages = ['en', 'pt']
@team.save!
Expand Down Expand Up @@ -52,15 +53,15 @@ 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

travel_to Time.parse('2024-01-02') do
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!
Expand Down

0 comments on commit 41fffaa

Please sign in to comment.