Commit graph

49 commits

Author SHA1 Message Date
kara Diaby
2930de1015 remove useless code in models 2021-03-24 17:47:24 +01:00
clemkeirua
f96377d878 refactor Dossier#with_notifications 2020-09-21 08:28:42 +00:00
simon lehericey
e4de522b48 only retrieve id of procedures with notifications 2020-09-11 09:43:04 +00:00
clemkeirua
c7b96d3d43 add feature-flip for instructeurs on cached notifications 2020-09-08 15:40:42 +00:00
Pierre de La Morinerie
6d28069539 models: generate annotations 2020-08-12 11:45:53 +02:00
Christophe Robillard
a072d35211 use traitement model
when a dossier is terminated (accepte, refuse or classe_sans_suite),
we store now `processed_at` and `motivation` in a traitement instance
2020-07-08 18:15:15 +02:00
Christophe Robillard
f683b850c3 Notifie instructeurs le souhaitant lors depot dossier
Notifie par mail uniquement les instructeurs qui le souhaitent à chaque dépôt de dossier
2020-04-09 15:02:05 +02:00
Christophe Robillard
969478b706 Envoie une notif aux followers_instructeurs le souhaitant
après chaque message déposé par l'usager
2020-04-09 14:17:07 +02:00
Paul Chavard
c763679b54 Remove non-existant columns from manager dashboards 2020-03-26 16:17:07 +01:00
kara Diaby
eb8df80c18 fix the email notifications data bug 2020-03-20 16:38:57 +01:00
kara Diaby
395af2fbb0 instructors : receive daily emails for declarative folders 2020-03-17 15:54:50 +01:00
Paul Chavard
3cd4597006 Update rubocop roules 2020-03-17 11:25:21 +01:00
Christophe Robillard
50007b2aac highlight demande tab when groupe instructeur updated 2020-03-04 14:56:59 +01:00
Christophe Robillard
9f7b78ff8b supprime les colonnes ignorées 2020-02-17 19:03:43 +01:00
Christophe Robillard
6e0d1eaee3 remove email ignored column for admin and instructeur 2020-02-17 15:01:40 +01:00
kara Diaby
0b8a59d5e9 Add the possibility to disable weekly email notifications (instructeur) && rename the column email_notifications_enabled to daily_email_notification_enabled 2020-02-12 13:02:31 +00:00
Christophe Robillard
cee4c5b8fb Revert "Revert "4127 fix superadmin supprime compte usager""
This reverts commit 751f24f7bb.
2020-02-04 16:07:01 +01:00
Pierre de La Morinerie
751f24f7bb
Revert "4127 fix superadmin supprime compte usager" 2020-01-21 18:57:54 +01:00
Christophe Robillard
a6d007dbd3 supprime un instructeur 2020-01-21 15:05:33 +01:00
clemkeirua
7e15c6a4a4 add filtering by group in procedure_overview
The weekly overview do not work for instructeurs in procedures with multiples groups ;
they see dossiers that they do not have access to. Now the correct filter is added
2020-01-20 14:23:19 +01:00
Pierre de La Morinerie
2e8d365b93 instructeurs: disable the email column 2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
f8358b3ae9 instructeurs: create without providing the email 2019-11-04 10:44:24 +01:00
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
Pierre de La Morinerie
a462edb9bc instructeurs: alias instructeur.email
This also means we need to replace instances of `pluck` on the email
column.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
cd478b489e instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
simon lehericey
4febf1851f notifications_for_procedure is now based on instructeur.groupe_instructeurs 2019-10-25 09:42:17 +02:00
Nicolas Bouilleaud
03c950ea97 Move followed_dossiers_with_notifications to a Dossier scope
Instead of instructeur.followed_dossiers_with_notifications, we can now write instructeur.followed_dossiers.with_notifications.

Yay composition!
2019-09-25 14:10:00 +02:00
Nicolas Bouilleaud
a4166d3c57 Refactor Instructeur.notifications_* methods
- rename `dossiers_id_with_notifications` to `followed_dossiers_with_notifications`,
- rename `notifications_per_procedure` to `procedures_with_notifications`,
- return an ActiveRecord::Relation instead of the result of the query, so that the call place can compose it,
- `merge` with the wanted Dossier scope in the call places, don’t bother passing it as a parameter,
- use the “state” (now “scope”) parameter as a scope method that can be just applied on `Dossier`.
2019-09-25 14:10:00 +02:00
Nicolas Bouilleaud
f74fde3f80 Avoid sending notification emails about archived dossiers 2019-09-20 11:06:33 +02:00
Nicolas Bouilleaud
769621de46 Explicitly pass the “state” param in notifications_*_procedure methods 2019-09-20 11:06:33 +02:00
Nicolas Bouilleaud
8a06c01f13 Reorder methods in instructeur.rb
Move token stuff together, out of notification-related stuff.
2019-09-20 10:48:08 +02:00
Nicolas Bouilleaud
4f0871dab0 Use a single query in dossiers_id_with_notifications (instead of four)
This is used in /procedures#show and /procedures#index, to display badges on the “suivis” and “traités” tabs of each procedure. Rails cache helps when it’s the exact same query, but it’s not the case for different tabs.

I’m not certain it’ll be a visible performance improvement but it shouldn’t hurt.
2019-09-20 09:45:59 +02:00
simon lehericey
21577a0f0b Instructeur: dedup procedures with multiple gi 2019-09-18 15:51:02 +02:00
Nicolas Bouilleaud
8fa630d2bb Remove Gestionnaire.visible_procedures
It is actually the same thing as Gestionnaire.procedures. It already included the procedures with paths as well as the archived procedures, and in production, there were no Gestionnaire for who procedures was returning a different result than visible_procedures (expect for two baddata brouillon procedures with a nil path).

In addition, Procedure.path is now nonnull, which means the Procedure.avec_lien scope is pointless.

Finally, the current spec showed that the only procedure not visible to the gestion was the one he was not assigned to.
2019-09-17 16:30:48 +02:00
Paul Chavard
88842918f9 Prepare to drop columns 2019-09-17 12:37:37 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Paul Chavard
c370c2f475 Cleanup FlipFlop 2019-09-10 23:52:44 +02:00
Paul Chavard
65e227c44b Migrate to flipper 2019-09-10 16:10:14 +02:00
simon lehericey
ad7ef6c739 Link assign_to and procedure by groupe_instructeur 2019-09-03 06:47:02 +02:00
simon lehericey
3cc8f0c792 Link Dossier and GroupeInstructeur 2019-09-03 06:47:02 +02:00
simon lehericey
85499365a0 Instructeur has_many procedures through groupe_instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
25991c2892 Assign a procedure assign a group as well 2019-09-02 11:41:12 +02:00
simon lehericey
97884c4349 Link AssignTo et GroupeInstructeur 2019-09-02 11:41:12 +02:00
simon lehericey
dab1519b8c Remove credenticals synchronisation logic 2019-08-16 11:35:19 +02:00
simon lehericey
5fdac38cb2 Fix instructeur invitation 2019-08-13 15:15:16 +02:00
simon lehericey
a84e07a376 Remove instructeur devise methods 2019-08-13 15:15:16 +02:00
simon lehericey
dd4ffb926c Link user and instructeur 2019-08-13 15:15:16 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
simon lehericey
6902f84b85 Brutally rename gestionnaire filename to instructeur 2019-08-12 13:47:01 +02:00
Renamed from app/models/gestionnaire.rb (Browse further)