Optimize notifications queries for badges by using exists?, not present?
`ActiveRecord::Relation.exists?` yields a SQL EXISTS query, while `present?` is a method of Enumerable, which needs the actual result array to be queried.
This commit is contained in:
parent
a4166d3c57
commit
1505d45be1
1 changed files with 2 additions and 2 deletions
|
@ -24,13 +24,13 @@
|
|||
instructeur_procedure_path(@procedure, statut: 'suivis'),
|
||||
active: @statut == 'suivis',
|
||||
badge: @followed_dossiers.count,
|
||||
notification: current_instructeur.notifications_for_procedure(@procedure, :en_cours).present?)
|
||||
notification: current_instructeur.notifications_for_procedure(@procedure, :en_cours).exists?)
|
||||
|
||||
= tab_item(t('pluralize.processed', count: @termines_dossiers.count),
|
||||
instructeur_procedure_path(@procedure, statut: 'traites'),
|
||||
active: @statut == 'traites',
|
||||
badge: @termines_dossiers.count,
|
||||
notification: current_instructeur.notifications_for_procedure(@procedure, :termine).present?)
|
||||
notification: current_instructeur.notifications_for_procedure(@procedure, :termine).exists?)
|
||||
|
||||
= tab_item('tous les dossiers',
|
||||
instructeur_procedure_path(@procedure, statut: 'tous'),
|
||||
|
|
Loading…
Reference in a new issue