-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unifier les créations de comptes pour les mairies et les comptes Saas #4871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encore un quick win qui vaut son pesant d'or ! 🚀
.where(organisations: { territory_id: Territory.mairies&.id }) | ||
.where(organisations: { ants_connectable: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est beau ! 🤩
up_only do | ||
mairies_territory = Territory.find_by(name: "Mairies") | ||
if mairies_territory # La migration tourne aussi sur l'instance historique qui n'a pas ce territoire | ||
Organisation.where(territory_id: mairies_territory.id).update_all(ants_connectable: true) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si mon cerveau est encore en vie, il me semble qu'on aura aucune interruption puisque la migration s'exécute dans une transaction, et que le l'ancien code est compatible avec le nouveau schéma. 🚀
expect(page).to have_link("modifier", href: prendre_rdv_path(departement: "MA", public_link_organisation_id: organisation.id, duration: 50)) | ||
expect(page).to have_link("modifier", | ||
href: prendre_rdv_path(departement: "MA", motif_name_with_location_type: passport_motif.name_with_location_type, public_link_organisation_id: organisation.id, | ||
duration: 50)) | ||
expect(page).to have_link("modifier", | ||
href: prendre_rdv_path(departement: "MA", lieu_id: lieu.id, motif_name_with_location_type: passport_motif.name_with_location_type, | ||
public_link_organisation_id: organisation.id, duration: 50)) | ||
|
||
expect(page).to have_link("modifier", href: prendre_rdv_path( | ||
departement: organisation.territory.departement_number, | ||
public_link_organisation_id: organisation.id, | ||
duration: 50 | ||
)) | ||
|
||
expect(page).to have_link("modifier", href: prendre_rdv_path( | ||
departement: organisation.territory.departement_number, | ||
motif_name_with_location_type: passport_motif.name_with_location_type, | ||
public_link_organisation_id: organisation.id, | ||
duration: 50 | ||
)) | ||
|
||
expect(page).to have_link("modifier", href: prendre_rdv_path( | ||
departement: organisation.territory.departement_number, | ||
lieu_id: lieu.id, | ||
motif_name_with_location_type: passport_motif.name_with_location_type, | ||
public_link_organisation_id: organisation.id, duration: 50 | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui s'il vous plaît merci beaucoup 🤩
if compte.save | ||
if compte.save! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Un peu étrange de voir un if
et une méthode bang, c'est contraire à la convention Rails de ne pas retourner de valeur pour les méthodes bang, mais plutôt de raise des exceptions.
Le choix de ce !
est-il motivé par la capacité de la méthode à lever des exceptions ?
Bref, c'est du chipotage, mais j'ai dû aller regarder l'implem de la méthode pour confirmer que c'était pas une erreur d'usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oui, cette méthode peut lever des exceptions, j'ai ajouté ça pour le rendre plus clair, mais j'ai eu la flemme de changer l'implém du controller pour mieux gérer ça
vu avec Matis et Léa : il faut vérifier comment les catégories de motifs s'afficheront pour les organisations qui n'ont pas vocation à se brancher à l'ants, et ça pose peut-être la question plus large de comment on clarifie ce branchement pour les agents. |
4e5a578
to
05e9c92
Compare
Okay, ça marche dans le cas où on commence par créer une mairie, et ensuite un ouvre un CCAS. |
fill_in(:compte_agent_last_name, with: "Factice") # Plusieurs champs ont le label "Nom", donc on utilise le name de l'input | ||
fill_in("Adresse mail", with: "francis@factice.org") | ||
select("Urbanisme", from: "Service") | ||
fill_in_form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chipotage : je pense qu’il aurait mieux valu dupliquer les appels plutôt que génériser, et éventuellement changer les valeurs pour la cohérence par ex fill_in("Nom de la première organisation", with: "Mairie de Romainville")
departement: organisation.territory.departement_number, | ||
lieu_id: lieu.id, | ||
motif_name_with_location_type: passport_motif.name_with_location_type, | ||
public_link_organisation_id: organisation.id, duration: 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chipotage ultime : le duration ne revient pas à la ligne
gros 👍 pour le réalignement en tout cas
@@ -52,7 +52,7 @@ def search_application_ids | |||
|
|||
def self.lieux | |||
Lieu.joins(:organisation) | |||
.where(organisations: { territory_id: Territory.mairies&.id }) | |||
.where(organisations: { ants_connectable: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
très cool en effet 🙇
En revanche, ça n’est pas 100% sûr avec la migration non ?
Si l’ANTS nous requête sur cet endpoint entre le moment où on déploie et le moment où la migration est achevée, on ne va pas renvoyer les bons lieux il me semble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
si, vu qu'on ajoute la colonne avant que le nouveau code soit actif
9d5166a
to
42402ae
Compare
42402ae
to
8468759
Compare
Avant
Après
Un formulaire unique, avec une checkbox à activer pour les mairies
Contexte
Cette PR est une première amélioration pour un point de douleur remonté par l'équipe déploiement pendant le séminaire : le fait que toutes les mairies soient dans le même territoire complique les choses.
C'est notamment impossible de permettre à une mairie qui utilise RDV SP de créer une organisation pour son CCAS en autonomie.
Ça limite aussi beaucoup les usages avancés du produit via l'espace admin, parce que les mairies n'ont pas accès à l'espace admin.
Ça complique le suivi de dossier pour l'équipe déploiement, parce qu'il n'y a pas le fonctionnement 1 territoire = 1 compte.
Solution
Cette PR est une première étape pour unifier les créations de comptes Saas et Mairies, et de faire que la connexion à l'ants soit une option supplémentaire, et pas un fonctionnement complètement différent.
On ajoute la colonne
organisations.ants_connectable
, et on pourra ensuite sortir individuellement des mairies du territoire commun avec le script fait pour cet usage (scripts/split_territory.rb
).