WIP optimize FindAvailabilityService by limiting creneaux computing to first ones
Created by: adipasquale
# find orgas with lots of agents and plage ouvertures
Agent.joins(:plage_ouvertures).all.flat_map { |agent| agent.organisations.map { [_1.id, agent.id] } }.group_by(&:first).transform_values { _1.count }.map { [_1
, _2] }.sort_by(&:last)
# find motif with lots of plage ouvertures
PlageOuverture.where(organisation_id: 101).flat_map { |po| po.motifs.map { [_1.id, po.id] } }.group_by(&:first).transform_values(&:count).to_a.sort_by(&:last)
=> le motif "Je souhaite avoir un entretien avec mon référent", sur place dans MDS Noisiel est un bon exemple de lenteur.