Skip to content
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

Création de compte candidat: refactoriser la sortie du bloc #5450

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

EwenKorr
Copy link
Contributor

@EwenKorr EwenKorr commented Jan 23, 2025

🤔 Pourquoi ?

Le bloc de recherche/création de compte candidat peut être utilisé dans plusieurs contextes (tunnels) différents :

  • candidature
  • embauche
  • GPS
  • et bientôt depuis l'espace Mes Candidats

Une fois qu'un compte est trouvé ou créé, l'utilisateur est redirigé vers une nouvelle page, en fonction du tunnel.
Cette PR est une proposition de refactorisation, pour clarifier la sortie du bloc.

🍰 Comment ?

Une nouvelle méthode, get_exit_url(), similaire à get_next_url() mais pour avoir l'URL de l'étape après le bloc.
Elle permet d'identifier les URLs de sortie de bloc.

@EwenKorr EwenKorr added the no-changelog Ne doit pas figurer dans le journal des changements. label Jan 23, 2025
@EwenKorr EwenKorr self-assigned this Jan 23, 2025
@EwenKorr
Copy link
Contributor Author

J'ai hésité sur deux choses :

  • où définir get_exit_url ? Comme souvent, je n'ai pas résisté à la tentation de mettre la fonction le plus haut possible (dans JobSeekerBaseView) pour avoir une vision d'ensemble, un seul endroit avec toute la logique. Mais ce n'est peut-être pas optimal ?
    Une autre solution serait de mettre une partie de la logique dans JobSeekerBaseView (pour CheckNIR et SearchByEmail) et une autre partie dans CreateJobSeekerForSenderBaseView.

  • créer de nouveaux tests dans job_seekers_views/test_create_or_update.py pour vérifier qu'on atterrit bien au bon endroit en fonction des tunnels. Et préparer l'arrivée du nouveau tunnel de création de compte candidat (depuis l'espace Mes candidats).
    Mais c'est long (on veut tester une suite d'étapes) et redondant avec les tests de apply, donc je ne suis pas allé au bout. Ça pourra peut-être attendre qu'on découpe apply/test_submit.py pour qu'on migre les tests sur la création de compte candidat dans job_seekers_views ?

@EwenKorr EwenKorr force-pushed the ewen/tunnel-exit branch 2 times, most recently from 7eadd5b to deba229 Compare January 23, 2025 15:09
@EwenKorr EwenKorr marked this pull request as ready for review January 23, 2025 15:11
Copy link
Contributor

@xavfernandez xavfernandez left a comment

Choose a reason for hiding this comment

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

get_exit_url me semble au bon endroit mais en bonus, je verrais bien une fusion de JobSeekerForSenderBaseView & JobSeekerBaseView (et oui, CheckNIRForJobSeekerView pose encore soucis 👀 )

@@ -363,7 +375,7 @@ def post(self, request, *args, **kwargs):
# TODO(ewen): check_job_seeker_info doesn't use the session yet,
# so we delete the session here.
self.job_seeker_session.delete()
return self.redirect_to_check_infos(self.job_seeker.public_id)
return HttpResponseRedirect(self.get_exit_url(self.job_seeker.public_id))
Copy link
Contributor

Choose a reason for hiding this comment

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

En vrai, on est dans CheckNIRForJobSeekerView (je t'ai déjà donné mon avis sur cette vue 😜 )

Suggested change
return HttpResponseRedirect(self.get_exit_url(self.job_seeker.public_id))
return HttpResponseRedirect(reverse("job_seekers_views:check_job_seeker_info", kwargs={"company_pk": self.company.pk, "job_seeker_public_id": job_seeker_public_id}))

comme dans le get juste au dessus me semble plus clair ;)

@EwenKorr
Copy link
Contributor Author

get_exit_url me semble au bon endroit mais en bonus, je verrais bien une fusion de JobSeekerForSenderBaseView & JobSeekerBaseView (et oui, CheckNIRForJobSeekerView pose encore soucis 👀 )

Le message va rentrer pour CheckNIRForJobSeekerView 😅

Super ! J'amende et fusionne lundi.
C'est vrai que JobSeekerForSenderBaseView n'apporte pas grand chose.
Je me note pour plus tard de travailler sur la fusion des JobSeeker*BaseView.

We introduce a `get_exit_url`, similar to `get_next_url` but for getting
the URL of the step *after* the block.
Depending on the tunnel, the output is different.
@EwenKorr EwenKorr added this pull request to the merge queue Jan 27, 2025
Merged via the queue into master with commit 1667fcc Jan 27, 2025
9 checks passed
@EwenKorr EwenKorr deleted the ewen/tunnel-exit branch January 27, 2025 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Ne doit pas figurer dans le journal des changements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants