Skip to content

Admin : Empêcher la modification directe de la date de fin d’un PASS IAE - #6484

Merged
francoisfreitag merged 5 commits into
masterfrom
ff/approval-end-date
Aug 22, 2025
Merged

francoisfreitag merged 5 commits into
masterfrom
ff/approval-end-date

Conversation

@francoisfreitag

Copy link
Copy Markdown
Member

🤔 Pourquoi ?

Éviter la mise à jour accidentelle de la date de fin du PASS IAE, dans le cas fréquent :

  1. Ouverture du PASS dans l’admin depuis Zendesk
  2. Ajout d’une prolongation dans un autre onglet
  3. Ajout d’un commentaire dans l’admin du PASS IAE
  4. Sauvegarde du PASS IAE

Dans ce déroulé, il manque une étape après 2., pour recharger la page du PASS IAE avec la nouvelle date de fin. C’est facile à oublier et cause des problèmes aux employeurs, car la durée du PASS est réduite sans raison.

@francoisfreitag francoisfreitag added the no-changelog Ne doit pas figurer dans le journal des changements. label Jul 7, 2025
@francoisfreitag francoisfreitag self-assigned this Jul 7, 2025
@francoisfreitag francoisfreitag added the no-changelog Ne doit pas figurer dans le journal des changements. label Jul 7, 2025
@francoisfreitag
francoisfreitag requested a review from EwenKorr July 7, 2025 13:52
@francoisfreitag
francoisfreitag marked this pull request as draft July 7, 2025 13:57
@francoisfreitag

Copy link
Copy Markdown
Member Author

Passée en brouillon car le support modifie parfois la date de fin.
https://gip-inclusion.slack.com/archives/C0412CTV63D/p1751896503896689?thread_ts=1751895105.057229&cid=C0412CTV63D

@francoisfreitag

francoisfreitag commented Jul 8, 2025 •

Copy link
Copy Markdown
Member Author

À résoudre :

  • clôture des PASS IAE (définir la date de fin du PASS à la date du jour et mettre à jour la date de fin de suspension et prolongation)
  • changement de date de début de PASS doit décaler la date de fin de PASS

@francoisfreitag
francoisfreitag force-pushed the ff/approval-end-date branch 2 times, most recently from 36dd997 to bb209ef Compare August 19, 2025 12:36
@francoisfreitag francoisfreitag added modifié Modifié dans le changelog. and removed no-changelog Ne doit pas figurer dans le journal des changements. labels Aug 19, 2025
@francoisfreitag
francoisfreitag marked this pull request as ready for review August 19, 2025 12:44
@francoisfreitag francoisfreitag added the 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC label Aug 19, 2025
@github-actions

Copy link
Copy Markdown

🥁 La recette jetable est prête ! 👉 Je veux tester cette PR !

Comment thread itou/approvals/admin_views.py Resolved
Comment thread itou/approvals/admin_views.py Resolved
@francoisfreitag
francoisfreitag force-pushed the ff/approval-end-date branch 2 times, most recently from 4ea079e to 04914a8 Compare August 21, 2025 13:25
Helps developers know where to insert their values.
This field is tricky. It is maintained via a PostgreSQL trigger, so that
prolongations and suspensions update the `end_at` value. In a typical
support team operation, they would open the Approval admin page (with
the old end_at), then add a prolongation in another tab, comment on the
approval admin page with the Zendesk ticket, and save the approval.
However, the `end_date` has not been refreshed after the prolongation
was saved, so the `end_date` computed by the trigger is overwritten by
the `end_date` submitted by the team member.
@francoisfreitag

Copy link
Copy Markdown
Member Author

J’ai ajouté des logs et rebasé sur les changements liés à User.__str__, je te laisse jeter un œil.

Comment thread tests/approvals/test_admin.py Resolved
Comment thread tests/approvals/test_admin.py Resolved
Comment thread tests/approvals/test_admin.py Resolved
Comment thread tests/approvals/test_admin.py Resolved
Comment thread itou/approvals/admin_views.py Resolved
Comment thread tests/approvals/test_admin.py Resolved
Comment thread tests/approvals/test_admin.py Resolved
In rare cases, the support team needs to close an approval. They would
manually set the end date to yesterday, remove future prolongations and
suspensions, and set the ongoing suspensions and prolongations end date
to yesterday.
Prevent common errors:
- forgetting to update the end_at field
- allowing a prolongation or suspension to start before the beginning of
  the Approval

@xavfernandez xavfernandez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@francoisfreitag
francoisfreitag added this pull request to the merge queue Aug 22, 2025
Merged via the queue into master with commit 1c3e709 Aug 22, 2025
@francoisfreitag
francoisfreitag deleted the ff/approval-end-date branch August 22, 2025 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC modifié Modifié dans le changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants