Skip to content

Commit 81de690

Browse files
committed
Avoid N+1 issue when rendering import count
Calling `patient` makes a query to the database whereas we just need the ID of the patient.
1 parent 9c42083 commit 81de690

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/components/app_imports_navigation_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def issues_text
4343

4444
unique_import_issues =
4545
(vaccination_records_with_issues + patients_with_issues).uniq do |record|
46-
record.is_a?(VaccinationRecord) ? record.patient : record
46+
record.is_a?(VaccinationRecord) ? record.patient_id : record.id
4747
end
4848

4949
count = unique_import_issues.count

0 commit comments

Comments
 (0)