-
Notifications
You must be signed in to change notification settings - Fork 25
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
PASS IAE: création d’une page de détails [GEN-12] #4719
Conversation
f375063
to
15eb475
Compare
🥁 La recette jetable est prête ! 👉 Je veux tester cette PR ! |
9186d2a
to
d7ce214
Compare
97003e9
to
2042054
Compare
1f9b791
to
f845d68
Compare
5151000
to
bbf886d
Compare
itou/www/approvals_views/views.py
Outdated
if application_states := self.object.user.job_applications.filter( | ||
to_company=self.request.current_organization, | ||
).values_list("state", flat=True): | ||
if any(state == JobApplicationState.ACCEPTED for state in application_states): | ||
is_employer_with_accepted_application = 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.
if application_states := self.object.user.job_applications.filter( | |
to_company=self.request.current_organization, | |
).values_list("state", flat=True): | |
if any(state == JobApplicationState.ACCEPTED for state in application_states): | |
is_employer_with_accepted_application = True | |
if self.object.user.job_applications.filter( | |
to_company=self.request.current_organization, state=JobApplicationState.ACCEPTED | |
).exists(): | |
is_employer_with_accepted_application = 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.
Alors non car je veux différencier les cas d'un employeur:
- ayant reçu une candidature pour ce candidat mais sans avoir accepté de candidature (droit d'accès mais sans voir les boutons)
- ayant reçu une candidature pour ce candidat et ayant déjà accepté une candidature (droit d'accès et les boutons)
Mais je suis d'accord que le code est piégeux, je vais rajouter une commentaire.
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.
Et même un test si possible 🙏
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.
(j’avais vérifié la suggestion avec la suite de test et de mémoire tout était passé)
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.
👍 Test ajouté dans fe5d2b2
d42037a
to
b1c33ae
Compare
abb3dd2
to
fe5d2b2
Compare
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 propre et bien organisé, un plaisir 💯
else: | ||
# test_func should prevent this case from happening but let's be safe | ||
logger.exception("This should never happen") | ||
raise PermissionDenied |
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.
nit: Je trouve que test_func
complexifie plus qu’il n’aide. On pourrait virer le mixin et commencer par : if request.user.kind not in (EMPLOYER, PRESCRIBER): raise PermissionDenied
.
Si on ne veut pas faire les tests au moment de get_context_data
, on pourrait faire le check dans le dispatch
avec un check sur request.user.is_authenticated
🤷
from tests.utils.test import assert_previous_step, assertSnapshotQueries, parse_response_to_soup | ||
|
||
|
||
class TestEmployeeDetailView: | ||
APPROVAL_NUMBER_LABEL = "Numéro de PASS IAE" | ||
APPROVAL_NUMBER_LABEL = "Numéro de PASS IAE" |
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.
On devrait garder l’espace insécable, PASS IAE va ensemble.
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, mais le nouveau template itou/templates/approvals/includes/box.html
ne le contient pas 😬
Il faudrait soit un commit préparatoire (mais je trouve 115 occurences de PASS IAE
sans espace insécable dans les templates 👀 ) soit un commit en suivant: je laisse la seconde option ouverte 👼
since it will be removed from employees_views and simplify it a little since it will soon be removed
fe5d2b2
to
4056357
Compare
🤔 Pourquoi ?
Pour alléger un peu l'encart du PASS IAE
🍰 Comment ?
🚨 À vérifier
🏝️ Comment tester
💻 Captures d'écran