demarches-normaliennes/app/models
Pierre de La Morinerie 8b8213c301 instructeurs: always eager load the user relationship
Now that `Instructeur.email` is merely an alias to `instructeur.user.email`,
and we changed every occurence of `instructeurs.pluck(:email)` to
`instructeurs.map(&:email)`, the new version using `map` may cause N+1 queries
if the users have not been preloaded.

It makes sense to always preload the user when fetching an Instructeur:

- Instructeur and User have a strongly coupled relationship
- It avoids N+1 queries everywhere in the app

Of course fetching an instructeur without needing its user will now do an
unecessary fetch of the associated user. But it seems better than leaving
a risk of N+1 queries in many places.
2019-11-04 10:44:24 +01:00
..
champs Add dossier champs and annotations types 2019-09-24 10:47:21 +02:00
concerns Move the cached procedure stats queries to a ProcedureStatsConcern 2019-09-17 16:43:48 +02:00
mails mailers: improve wording of transactional emails and default templates 2019-07-25 12:25:50 +02:00
types_de_champ Serialize champ repetition for tags 2019-09-12 17:23:18 +02:00
.keep First Commit 2015-08-10 11:05:06 +02:00
administrateur.rb instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
administrateurs_procedure.rb [Ref #1626] Add the administrateurs_procedures table and associations 2018-03-23 11:40:03 +01:00
administration.rb Add User.create_or_promote_to_administrateur 2019-08-20 12:20:12 +02:00
application_record.rb Resolve models and types 2019-09-24 10:47:21 +02:00
assign_to.rb Link assign_to and procedure by groupe_instructeur 2019-09-03 06:47:02 +02:00
attestation.rb Remove duplicated attachments 2019-09-17 18:12:53 +02:00
attestation_template.rb Remove duplicated attachments 2019-09-17 18:12:53 +02:00
avis.rb instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
bill_signature.rb Add BillSignature Model 2019-06-17 16:16:28 +02:00
champ.rb Invite experts to linked dossiers 2019-10-23 13:10:09 +02:00
commentaire.rb Prepare to drop columns 2019-09-17 12:37:37 +02:00
current.rb Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
deleted_dossier.rb Enforce Timezone rule in Rubocop 2019-02-18 16:19:42 +01:00
demande.rb [fix #1601] show pipedrive demandes in manager 2018-03-22 15:37:16 +01:00
dossier.rb instructeurs: alias instructeur.email 2019-11-04 10:44:24 +01:00
dossier_operation_log.rb Migrate to flipper 2019-09-10 16:10:14 +02:00
drop_down_list.rb Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
entreprise.rb Remove entreprise and rna_information models 2018-05-24 17:54:51 +02:00
etablissement.rb Add default etablissement champ name 2019-07-30 17:17:36 +02:00
exercice.rb Remove unused alias 2018-05-24 17:54:51 +02:00
feedback.rb Add AR validation for Feedback rating 2018-08-28 10:36:36 +02:00
follow.rb Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
france_connect_information.rb Remove the mandataire_social guess 2018-03-20 16:09:00 +01:00
france_connect_particulier_client.rb FC initializers: remove Hashie 2018-01-15 17:08:38 +01:00
geo_area.rb Save selection utilisateur as geo area 2019-08-01 11:38:09 +02:00
groupe_instructeur.rb Add constraints to GroupeInstructeur 2019-10-23 21:47:20 +02:00
individual.rb introduce constants for M./Mme 2019-08-01 17:42:32 +02:00
instructeur.rb instructeurs: always eager load the user relationship 2019-11-04 10:44:24 +01:00
invite.rb [Fix #1619] Do not consider invitations to deleted dossiers 2018-03-15 11:32:21 +01:00
module_api_carto.rb Remove unused carto models 2018-11-27 16:11:25 +01:00
procedure.rb add a warning during export generation 2019-10-24 16:27:10 +02:00
procedure_overview.rb DateTime.now => Time.zone.now 2018-10-26 10:10:20 +00:00
procedure_presentation.rb Move followed_dossiers_with_notifications to a Dossier scope 2019-09-25 14:10:00 +02:00
service.rb Prepare to drop columns 2019-09-17 12:37:37 +02:00
siret.rb Do one thing per line 2018-10-01 16:15:46 +02:00
trusted_device_token.rb Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
type_de_champ.rb Invite experts to linked dossiers 2019-10-23 13:10:09 +02:00
user.rb User: eager load instructeur and administrateur to remove 2 db requests per http request 2019-10-08 09:53:40 +02:00