Skip to content

Fix profiles count in home page category bar view#1560

Merged
tyranja merged 11 commits intomainfrom
fix-profiles-count-in-home-page-category-bar-view
Jan 24, 2026
Merged

Fix profiles count in home page category bar view#1560
tyranja merged 11 commits intomainfrom
fix-profiles-count-in-home-page-category-bar-view

Conversation

@tyranja
Copy link
Member

@tyranja tyranja commented Jan 24, 2026

No description provided.

@tyranja tyranja requested a review from Copilot January 24, 2026 15:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes profile counting in the home page category bar by ensuring that only profiles with tags in the current locale (or without locale restrictions) are counted. The changes include refactoring the factory patterns for locale languages and tags to use traits and transient attributes, updating the CategoriesProfilesStats interactor to filter by locale, and adding comprehensive test coverage for locale-specific counting behavior.

Changes:

  • Refactored factory definitions to use traits (:en, :de) and transient locales attribute for cleaner test setup
  • Updated CategoriesProfilesStats to filter profiles by current locale using LEFT OUTER JOINs
  • Added test coverage for locale-specific profile counting in different regions

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/system/tag_spec.rb Updated to use new factory trait pattern and renamed variables for clarity
spec/system/searching_for_profiles_spec.rb Updated locale language factory call to use trait
spec/system/profile_spec.rb Updated locale language factory calls to use traits and removed trailing whitespace
spec/system/admin/tags_spec.rb Updated to use new factory trait pattern and removed FactoryBot. prefix
spec/services/tag_filter_spec.rb Updated locale language factory calls to use traits
spec/models/locale_language_spec.rb Updated to use new factory trait pattern and renamed variables for clarity
spec/interactor/categories_profiles_stats_spec.rb Added comprehensive tests for locale-specific profile counting across different regions
spec/factories/tags_factory.rb Added transient locales attribute and after-create callback for tag-locale associations
spec/factories/tag_slocale_language_factory.rb New factory for tags_locale_language join table records
spec/factories/locale_language_factory.rb Converted nested factories to traits with default iso_code
app/interactor/categories_profiles_stats.rb Refactored to filter profiles by locale and added locale to cache keys

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +4
# frozen_string_literal: true

FactoryBot.define do
factory :tags_locale_language do
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename 'tag_slocale_language_factory.rb' contains a typo. It should be 'tags_locale_language_factory.rb' to match the factory name and the join table model name.

Copilot uses AI. Check for mistakes.
@tyranja tyranja merged commit 6e76ccb into main Jan 24, 2026
1 check passed
@tyranja tyranja deleted the fix-profiles-count-in-home-page-category-bar-view branch January 24, 2026 16:09
tyranja added a commit that referenced this pull request Jan 24, 2026
* add the language (I18n) filter to the profiles count and tags count in the category bar
* add not translated tags to the query


---------

Co-authored-by: Maren Heltsche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants