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

GEIQ: Bilan d'exécution #4110

Merged
merged 5 commits into from
Jun 17, 2024
Merged

GEIQ: Bilan d'exécution #4110

merged 5 commits into from
Jun 17, 2024

Conversation

xavfernandez
Copy link
Contributor

🤔 Pourquoi ?

Indiquez le problème que nous sommes en train de résoudre et les objectifs métiers ou techniques qui sont visés par ces changements.

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

💻 Captures d'écran

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?

🏝️ 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.

@xavfernandez xavfernandez added 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC ajouté Ajouté dans le changelog. labels May 21, 2024
@xavfernandez xavfernandez self-assigned this May 21, 2024
Copy link

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

@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch 10 times, most recently from 9854f7a to 251a901 Compare May 27, 2024 14:53
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch 16 times, most recently from 0ddf52a to 45cd526 Compare June 6, 2024 21:27
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch 3 times, most recently from f5f2321 to daff556 Compare June 13, 2024 08:59
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch from daff556 to 95610b2 Compare June 13, 2024 09:14
@xavfernandez xavfernandez added no-changelog Ne doit pas figurer dans le journal des changements. and removed no-changelog Ne doit pas figurer dans le journal des changements. labels Jun 13, 2024
Copy link
Contributor

@francoisfreitag francoisfreitag left a comment

Choose a reason for hiding this comment

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

La synchro est un peu compliquée à cause des défauts de l’API, mais le code est super propre ! 👍

itou/geiq/models.py Outdated Show resolved Hide resolved
itou/geiq/models.py Show resolved Hide resolved
itou/geiq/models.py Outdated Show resolved Hide resolved
itou/geiq/models.py Outdated Show resolved Hide resolved
itou/geiq/models.py Show resolved Hide resolved
itou/geiq/sync.py Show resolved Hide resolved
itou/geiq/sync.py Show resolved Hide resolved
current_end = new_end
else: # new_start > current_end
# new distinct period found: count the current one and switch to the new one
nb_days += (current_end - current_start).days + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

J’espère qu’il est bien documenté que la date de fin est inclusive…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pas documenté mais ça me semblait évident 😬 .
Et si ce n'est pas le cas, on nous le dira 😇 .

itou/geiq/sync.py Outdated Show resolved Hide resolved
itou/utils/apis/geiq_label.py Show resolved Hide resolved
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch from 015dbff to 9abceaf Compare June 13, 2024 12:33
Copy link
Contributor

@francoisfreitag francoisfreitag left a comment

Choose a reason for hiding this comment

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

C’est top, les vues donnent vraiment l’impression d’être une transformation bête et méchante des données, la complexité étant déjà gérée dans le mécanisme de sync. Les permissions m’ont l’air OK, et c’est très simple à suivre 💯

itou/geiq/admin.py Outdated Show resolved Hide resolved
itou/geiq/admin.py Show resolved Hide resolved
itou/templates/geiq/assessment_info_for_employer.html Outdated Show resolved Hide resolved
</form>
</div>
</div>
<div class="col-12 col-lg-4">
Copy link
Contributor

Choose a reason for hiding this comment

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

J’espère que le commentaire de la DDETS sera court…

name="employee_details",
),
path(
"list/<int:institution_pk>",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ne faudrait-il pas prévoir de passer l’assessment dans l’URL pour historiser ces données ?

logger.warning("Error while syncing Label data for assessement=%s", assessment)
messages.error(request, "Erreur lors de la synchronisation avec Label.")

match info_type:
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool !

employees = Employee.objects.filter(
assessment__company_id__in={org.pk for org in request.organizations},
).select_related("assessment__campaign")
employee = get_object_or_404(employees, pk=employee_pk)
Copy link
Contributor

Choose a reason for hiding this comment

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

Juste pour confirmer, le même employé ne devrait pas apparaître dans deux assessments différents, parce qu’on devrait recréer un employé à chaque fois ? (cas DDETS)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alors un même employé peut apparaître dans plusieurs ImplementationAssessments différents mais cela sera sous la forme de 2 objets Employee différents chacun rattaché à son ImplementationAssessment.

):
membership = InstitutionMembershipFactory(institution__kind=institution_kind)
user = membership.user
self.client.force_login(user)
Copy link
Contributor

Choose a reason for hiding this comment

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

Romain m’a fait remarqué qu’on peut passer l’assertion directement dans le parametrize.

response = client.post(reverse("geiq:label_sync", kwargs={"assessment_pk": assessment.pk}))
assessment.refresh_from_db()
assert assessment.last_synced_at is not None
assertContains(response, "Dernière synchronisation:")
Copy link
Contributor

Choose a reason for hiding this comment

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

Ce serait aussi le cas s’il n’y avait pas eu de dernière synchronisation (le texte serait Dernière synchronisation: -). Peut-être mettre la date ?

tests/www/geiq_views/tests.py Outdated Show resolved Hide resolved
Copy link
Contributor

@francoisfreitag francoisfreitag left a comment

Choose a reason for hiding this comment

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

Gros gros boulot, mais finalement suffisamment digeste pour qu’on suive bien.
Sans connaissance de l’API Label et ses petites facéties, difficile de trouver des cas qui mettront en défaut le code. Mais au moins, je suis plutôt serein sur le fait que les erreurs nous remonteront rapidement, et surtout qu’il sera facile d’intervenir. 🎩

@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch 2 times, most recently from 5fe1da8 to cd8bf65 Compare June 14, 2024 07:41
@xavfernandez xavfernandez marked this pull request as ready for review June 14, 2024 12:03
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch from eb5d6ee to 524e86f Compare June 17, 2024 09:13
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch from 524e86f to 9d24cae Compare June 17, 2024 12:19
@xavfernandez xavfernandez added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch from 9d24cae to cac2e0c Compare June 17, 2024 12:45
@xavfernandez xavfernandez force-pushed the xfernandez/api_label branch from cac2e0c to 5d2aa15 Compare June 17, 2024 12:46
@xavfernandez xavfernandez enabled auto-merge June 17, 2024 12:49
@xavfernandez xavfernandez added this pull request to the merge queue Jun 17, 2024
Merged via the queue into master with commit 11a1481 Jun 17, 2024
10 of 11 checks passed
@xavfernandez xavfernandez deleted the xfernandez/api_label branch June 17, 2024 13:01
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 ajouté Ajouté dans le changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants