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

Fiches salarié: Faciliter la saisie des nouvelles fiches salariés [GEN-749] #5469

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tonial
Copy link
Contributor

@tonial tonial commented Jan 27, 2025

🤔 Pourquoi ?

Il manque :

  • Du code à affiner (voir le second commit)
  • Le get_form_kwarg() qui semble être appelé 20 fois (soit faire une mise en cache, soit comprendre pourquoi)
  • Les remarques faits sur Figma pour reprendre le wording avec la bénédiction des designers
  • Des tests écrire quand les autres points seront réglés :)

🍰 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

@tonial tonial requested a review from rsebille January 27, 2025 08:26
@tonial tonial self-assigned this Jan 27, 2025
@tonial tonial force-pushed the alaurent/missing_employee_record branch 2 times, most recently from d8889a5 to 26575df Compare January 27, 2025 10:39
itou/www/employee_record_views/views.py Outdated Show resolved Hide resolved
@@ -81,9 +83,16 @@ def dispatch(self, request, *args, **kwargs):
return super().dispatch(request, *args, **kwargs)

def get_form_kwargs(self, step=None):
# Why is it called 20 times ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Oo, j'ai pas du tout souvenir de ce comportement 🙈.
A confirmer mais un @functools.cache() devrais fonctionner car normalement ni self.company ni self.get_cleaned_data_for_step("choose-employee")["employee"] ne devrait être modifié pour la même instance du formulaire mais on est pas à l'abri que ça soit le cas...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Le coupable est ce commit : 6f9e9d0
et la condition qui appelle le formulaire qui fait une requête, et cela en boucle via je ne sais quelle mystère que je n'ai pas trop creusé.

Cela explique aussi pourquoi on a étape 1/1 :
image
On "masque" l'étape suivante.

J'aimerai améliorer le fonctionnement de la vue, sauf que je ne sais pas quel est le bug que tu avais voulu corriger vu qu'on n'a plus l'historique sentry :/
Est-ce que par hazard tu t'en rappellerais ?
Le commit dit : www.employee_record: Prevent errors if a user go back to add last step
Est-ce que c'est s'il fait un get sur la dernière url (avec un précédent du navigateur) ?

J'aurais bien envie de bazarder la wizard view pour mettre un formulaire tout simple avec deux champs : le salarié, et le PASS (disabled au début, et dont les choix dépendent du salarié) mais ça fait du js non testé :(
(et ça correspond assez bien au message que tu avais mis : #3369 (comment))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

En effet après un retour navigateur ça plante.
Je vais ajouter un test explicite sur ce comportement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Après avoir bien creusé, j'ai quand même bien l'impression que cette lib a plein de soucis...
Cette histoire de retour arrière devrait se poser pour chacun de nos wizards.
Il faudrait systématiquement vérifier que le form de l'étape d'avant a un cleaned_data quand on essaye d'accéder à une étape particulière, mais ça revient à patcher au milieu de NamedUrlWizardView.get() ....

Copy link
Contributor

Choose a reason for hiding this comment

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

De mémoire l'erreur Sentry était une KeyError "choose-employee" car la session n'existe plus après l'étape done.
Et oui j'ai jamais compris pourquoi celui-ci avait ce comportement alors que celui pour les demandes de prolongations utilise aussi le condition_dict et y avais pas ce genre de problèmes, peut-être parce que le formulaire n'a que 2 vues dont 1 conditionnelles et donc les first, current, next, last sont un peu toujours les mêmes 🤷

Après avoir bien creusé, j'ai quand même bien l'impression que cette lib a plein de soucis...

Comme je disais dans mon autre commentaire, celui en POST à l'air plutôt OK mais celui avec les vues part vite en couille, mais c'est le seul formulaire qui posais problème donc j'étais tenté de dire que c'était notre utilisation qui était mauvaise :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dans les demandes de prolongation, on attend la fin de la première étape pour compter ^^
Du coup à la première étape, on a une barre de progression à 50% mais on ne marque pas étape 1/1
Et à la seconde étape, quand on sait s'il y aura une 3eme étape, on arrive à 66% avec 2/3 si c'est le cas.

itou/approvals/admin.py Outdated Show resolved Hide resolved
@tonial tonial force-pushed the alaurent/missing_employee_record branch 2 times, most recently from df7b372 to ab1a9d7 Compare February 3, 2025 06:29
@tonial tonial changed the title Fiches salarié: Faciliter la saisie des nouvelles fiches salariés Fiches salarié: Faciliter la saisie des nouvelles fiches salariés [GEN-749] Feb 3, 2025
@tonial tonial force-pushed the alaurent/missing_employee_record branch 2 times, most recently from c8e9fe1 to d47f648 Compare February 4, 2025 10:07
@tonial tonial added the 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC label Feb 4, 2025
@tonial tonial force-pushed the alaurent/missing_employee_record branch from d47f648 to c987d72 Compare February 4, 2025 12:45
@tonial tonial 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 Feb 4, 2025
@tonial tonial marked this pull request as ready for review February 4, 2025 12:46
@tonial tonial requested a review from xavfernandez February 4, 2025 12:47
@tonial tonial force-pushed the alaurent/missing_employee_record branch from c987d72 to 5cd26df Compare February 4, 2025 12:48
Copy link

github-actions bot commented Feb 4, 2025

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

@tonial tonial force-pushed the alaurent/missing_employee_record branch from 5cd26df to b720627 Compare February 4, 2025 14:39
@tonial tonial requested a review from rsebille February 5, 2025 05:44
@tonial tonial force-pushed the alaurent/missing_employee_record branch 2 times, most recently from 8090516 to f828bd9 Compare February 7, 2025 13:30
itou/templates/employee_record/list.html Outdated Show resolved Hide resolved
itou/templates/employee_record/list.html Show resolved Hide resolved
itou/www/employee_record_views/views.py Outdated Show resolved Hide resolved
@tonial tonial force-pushed the alaurent/missing_employee_record branch from f828bd9 to 0af7222 Compare February 8, 2025 20:37
@tonial tonial force-pushed the alaurent/missing_employee_record branch 2 times, most recently from 5fbd20a to 37767b1 Compare February 10, 2025 09:58
@hellodeloo hellodeloo self-requested a review February 10, 2025 10:09
@tonial tonial force-pushed the alaurent/missing_employee_record branch from 37767b1 to e79e8c0 Compare February 10, 2025 10:10
</div>
<div class="col">
{% if num_recently_missing_employee_records == 1 %}
<p>1 nouveau salarié, embauché il y a moins de 4 mois, n’a pas encore de fiche salarié.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Avec un .mb-0 sur <p> ça ira mieux pour l'alignement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

merci

@tonial tonial force-pushed the alaurent/missing_employee_record branch 2 times, most recently from 1b05285 to c67bd79 Compare February 10, 2025 14:40
The name case is already handled in the get_full_name method
Only display employee without record, and in -hiring_start_at order
Adapt steps wording accordingly
@tonial tonial force-pushed the alaurent/missing_employee_record branch from c67bd79 to 2da7cb5 Compare February 10, 2025 20:49
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é
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants