Skip to content

Candidature : Affichage des critères d’éligibilité IAE et GEIQ dans les vues “liste” et “tableau” de la page de suivi de candidature des prescripteurs - #7032

Merged
EwenKorr merged 3 commits into
masterfrom
ewen/display-criteria
Nov 10, 2025
Merged

Candidature : Affichage des critères d’éligibilité IAE et GEIQ dans les vues “liste” et “tableau” de la page de suivi de candidature des prescripteurs#7032
EwenKorr merged 3 commits into
masterfrom
ewen/display-criteria

Conversation

@EwenKorr

@EwenKorr EwenKorr commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

🤔 Pourquoi ?

On a une colonne critères IAE alors que les prescripteurs réalisent des orientations hors IAE

Gros diff mais il y a du changement dans les snapshots. J'ai décidé de garder tous les petits commits dans cette même PR pour avoir le contexte des changements. Et j'ai essayé autant que possible de rédiger des messages de commit clairs.

carte Notion

🍰 Comment ?

Décrivez en quelques mots la solution retenue et mise en oeuvre, les difficultés ou problèmes rencontrés. Attirez l'attention sur les décisions d'architecture ou de conception importantes.

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?
  • Ajouter l'étiquette « Bug » ?

🏝️ Comment tester ?

Les instructions pour reproduire le problème, les profils de test, le parcours spécifique à utiliser, etc. Si vous disposez d'une recette jetable, mettre l'URL pour tester dans cette partie.

💻 Captures d'écran

@EwenKorr EwenKorr added the modifié Modifié dans le changelog. label Oct 22, 2025
@EwenKorr EwenKorr self-assigned this Oct 22, 2025
@EwenKorr
EwenKorr marked this pull request as draft October 22, 2025 08:53
@EwenKorr EwenKorr added the 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC label Oct 22, 2025
@github-actions

Copy link
Copy Markdown

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

Comment thread itou/templates/apply/includes/eligibility_badge.html Outdated
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch 5 times, most recently from 9d5fef9 to 1b012dc Compare October 27, 2025 08:54
@EwenKorr

Copy link
Copy Markdown
Contributor Author

J'ai pour l'instant laissé sous le tapis les filtres sur les critères administratifs qui ne concernent que l'IAE.
C'est actuellement un peu bancal déjà (par exemple, en tant que GEIQ si je regarde les candidatures reçues et si je filtre par critère, ce sont les critères IAE qui sont utilisé, bien qu'affichés nulle part : https://demo.emplois.inclusion.beta.gouv.fr/apply/siae/list?display=table&order=-created_at&criteria=1)

On pourra peut-être masquer ce filtre si on a uniquement des candidatures non IAE, et préciser dans le nom du filtre qu'il s'agit des critères IAE.

@EwenKorr EwenKorr closed this Oct 27, 2025
@EwenKorr EwenKorr reopened this Oct 27, 2025
@EwenKorr
EwenKorr marked this pull request as ready for review October 27, 2025 10:16
@EwenKorr
EwenKorr requested a review from leo-naeka October 27, 2025 10:20
@EwenKorr EwenKorr added 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC and removed 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC labels Oct 28, 2025
@github-actions

Copy link
Copy Markdown

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

Comment thread tests/job_applications/tests.py Outdated
qs = JobApplication.objects.with_jobseeker_geiq_eligibility_diagnosis().get(pk=job_app.pk)
assert qs.jobseeker_geiq_eligibility_diagnosis == diagnosis.pk

def test_with_jobseeker_geiq_eligibility_diagnosis_with_a_denormalized_diagnosis_from_the_prescriber(self):

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.

Pourquoi denormalized?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

J'ai suivi la nomenclature des tests précédents sur l'éligibilité IAE.
Ici denormalized veut dire que le diag n'est pas directement associé à la candidature ?

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.

bah justement pour moi une donnée dénormalisée c'est quand tu stockes un résultat sur un objet plutôt que de faire des jointures/etc.
Donc dénormalisé serait plutôt le cas où un diag est stocké sur une candidature (même si ça ne serait pas vraiment dénormalisé non plus...)
=> En tout cas, je ne pense pas que conserver ce nom aide la compréhension 😅

Comment thread tests/job_applications/tests.py

@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.

Il me reste le dernier commit à relire

Comment thread itou/templates/apply/includes/list_card_body.html Outdated

@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.

Cela me semble très bien. Après comme tu le dis cela va mettre en exergue le soucis du filtre des critères d'éligibilité: il faudrait peut-être effectivement clarifier que ce sont des critères IAE.

Comment thread itou/templates/apply/includes/list_card_body.html Outdated
Comment thread itou/templates/apply/includes/list_tr.html
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch 2 times, most recently from b2801c5 to 1a58d14 Compare October 28, 2025 16:33

@EwenKorr EwenKorr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Après comme tu le dis cela va mettre en exergue le soucis du filtre des critères d'éligibilité: il faudrait peut-être effectivement clarifier que ce sont des critères IAE.

Zohra a validé l'ajoute de IAE dans le filtre pour Critères administratifs IAE déclarés.

Et côté employeur, on peut carrément supprimer ce filtre si on n'est pas dans l'IAE : #7063

Comment thread tests/job_applications/tests.py Outdated
qs = JobApplication.objects.with_jobseeker_geiq_eligibility_diagnosis().get(pk=job_app.pk)
assert qs.jobseeker_geiq_eligibility_diagnosis == diagnosis.pk

def test_with_jobseeker_geiq_eligibility_diagnosis_with_a_denormalized_diagnosis_from_the_prescriber(self):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

J'ai suivi la nomenclature des tests précédents sur l'éligibilité IAE.
Ici denormalized veut dire que le diag n'est pas directement associé à la candidature ?

Comment thread tests/job_applications/tests.py
Comment thread itou/templates/apply/includes/list_tr.html
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch 3 times, most recently from f787eb4 to 498ff44 Compare October 31, 2025 08:57
@EwenKorr
EwenKorr marked this pull request as draft November 3, 2025 09:29
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch from 498ff44 to 7f82d55 Compare November 3, 2025 13:42

@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.

J'ai l'impression qu'on ne gère pas le cas:
candidature acceptée avec un diag GEIQ expiré sur critère A et B dont le candidat a un nouveau diag non expiré avec critères C et D
=> on affichera a priori la candidature avec le nouveau diag et les critères C et D dans la liste alors que je m'attendrais à voir le diag expiré (et les critères A et B).

Comment thread itou/job_applications/models.py Outdated
Comment on lines +325 to +356
.annotate(
level_two_criteria_count=Count(
"selected_administrative_criteria",
filter=Q(administrative_criteria__level=AdministrativeCriteriaLevel.LEVEL_2),
),
)
.filter(
# Authorized prescriber diagnosis (only authorized prescribers may create a GEIQ diagnosis,
# so if the author is a prescriber he was authorized when he created it)
Q(
author_kind=AuthorKind.PRESCRIBER,
)
# >=1 level 1 criterion
| Exists(
GEIQSelectedAdministrativeCriteria.objects.filter(
administrative_criteria__level=AdministrativeCriteriaLevel.LEVEL_1,
eligibility_diagnosis=OuterRef("pk"),
)
)
# >=2 level 2 criteria
| Q(level_two_criteria_count__gt=1)
# # >=1 annex 1 and 1+2 criterion
| Exists(
GEIQSelectedAdministrativeCriteria.objects.filter(
administrative_criteria__annex__in=[
AdministrativeCriteriaAnnex.ANNEX_1,
AdministrativeCriteriaAnnex.BOTH_ANNEXES,
],
eligibility_diagnosis=OuterRef("pk"),
),
),
)

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.

On pourrait ne mettre cela que pour for_prescriber=False, ce qui allègerait un peu la requête dans l'autre cas.

@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch from 4d0b7ae to 6d88e3f Compare November 7, 2025 14:48
@EwenKorr

EwenKorr commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

J'ai l'impression qu'on ne gère pas le cas: candidature acceptée avec un diag GEIQ expiré sur critère A et B dont le candidat a un nouveau diag non expiré avec critères C et D => on affichera a priori la candidature avec le nouveau diag et les critères C et D dans la liste alors que je m'attendrais à voir le diag expiré (et les critères A et B).

C'est vrai :/

Je viens de creuser le sujet, et je m'aperçois que la même logique s'applique côté IAE : on passe à eligibility_badge.html la valeur job_application.jobseeker_valid_eligibility_diagnosis qui récupère le dernier diag valide pour le candidat et l'entreprise.

Et d'ailleurs, cela crée une incohérence dans le cas où une candidature a un diagnostic expiré :

  • les critères sont bien ceux du diag expiré de la candidature ( _add_administrative_criteria utilise jobseeker_eligibility_diagnosis, qui renvoie le diag candidature quel qu'il soit)
  • mais le badge va chercher le dernier diag valide (jobseeker_valid_eligibility_diagnosis)

GEIQ et IAE sont faux (enfin, il faudra peut-être confirmer avec le métier qu'on veut absolument le diag associé à la candidature) mais cohérents 😅
Peut-être qu'on pourra corriger les deux en même temps ?


Et le premier commit actuel (www.apply: simplify eligibility_badge.html for GEIQ eligibility) s'était échappé des PR préparatoires, je le remets ici.

@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch 5 times, most recently from ac4e1ae to 59d4808 Compare November 10, 2025 10:27
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch from 59d4808 to d90f2b7 Compare November 10, 2025 13:46
Comment on lines +7678 to 7684
<span class="badge badge-sm rounded-pill bg-warning-lighter text-warning">
<i aria-hidden="true" class="ri-error-warning-line">
</i>
Éligibilité GEIQ confirmée
Éligibilité GEIQ non confirmée
</span>
<span class="d-block">
Diagnostic public prioritaire GEIQ validé par un prescripteur habilité

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

La formulation sera peut-être à revoir, mais au moins ça permet de montrer qu'il y a eu un diagnostic (ici réalisé par un PH) et qu'il n'est plus valide.

@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch from d90f2b7 to 31e308b Compare November 10, 2025 13:53
In the same way as IAE diagnoses, to be able to display eligibility
badges in prescriptions tables.

One note: the GEIQ eligibility diagnosis badges appear valid when
the considered diagnosis is not expired *and* when it grants an
allowance. Hence, `with_jobseeker_geiq_eligibility_diagnosis` filters
out diagnoses whose criteria or author do not grant the allowance.

To get the last job seeker valid diagnosis without allowance, use
`with_jobseeker_valid_geiq_eligibility_diagnosis`.
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch 2 times, most recently from 3fe9ffd to 25eb033 Compare November 10, 2025 14:17
def test_with_jobseeker_geiq_eligibility_diagnosis_id(self):
job_app = JobApplicationFactory(with_geiq_eligibility_diagnosis=True)
diagnosis = job_app.geiq_eligibility_diagnosis
qs = JobApplication.objects.with_jobseeker_geiq_eligibility_diagnosis_id().get(pk=job_app.pk)

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.

nit: dans tout ce test (et le suivant) qs n'est pas un queryset ce qui est un peu perturbant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This commit only adds GEIQ criteria in the prescriptions list, which is
straightforward:
as a prescriber or prescribing employer, I only see prescriber GEIQ
diagnoses, which grant the GEIQ allowance de facto.

However we worked on a more complete solution, that would have displayed
GEIQ criteria for received job applications, in list_for_siae. In this
case, a valid diagnosis made by an employer can lead to no allowance. We
developed a logic in the JobApplication querysets to handle this in
previous commits, but due to lack of time, we did not apply it to
list_for_siae.
@EwenKorr
EwenKorr force-pushed the ewen/display-criteria branch from 25eb033 to 0c23e14 Compare November 10, 2025 14:47
@EwenKorr
EwenKorr added this pull request to the merge queue Nov 10, 2025
Merged via the queue into master with commit 533a9fb Nov 10, 2025
14 checks passed
@EwenKorr
EwenKorr deleted the ewen/display-criteria branch November 10, 2025 15:28
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