diff --git a/app/models/person.rb b/app/models/person.rb index 8b3169d94..30c7f1b99 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -67,9 +67,10 @@ def rebuild_by_project_id(project_id) end def include_relations_and_order_by_kudo_position_and_name(name_id) - includes({ project: [{ best_analysis: :main_language }, :logo] }, :name, name_fact: :primary_language) - .where(name_id: name_id) - .order(Arel.sql('COALESCE(kudo_position, 999999999), lower(effective_name)')) + joins(project: :best_analysis).includes({ project: [{ best_analysis: :main_language }, :logo] }, :name, + name_fact: :primary_language) + .where(name_id: name_id) + .order(Arel.sql('COALESCE(kudo_position, 999999999), lower(effective_name)')) end def unclaimed_people(opts)