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

Trier les fiches de détection par numéro séquentiel et non par ID #755

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

alanzirek
Copy link
Collaborator

@alanzirek alanzirek commented Feb 25, 2025

  • Sélectionner la première fiche de détection par numéro et non par ID dans la vue détail événement
  • MAJ des tests avec factories
    • Remplacement de baker par des factories dans quelques tests
    • Ajout d'une méthode create_miniaml pour créer une factory Lieu ou Prelevement avec uniquement les champs obligatoires
    • Ajout de la factory PosistionChaineDistribution

@alanzirek alanzirek force-pushed the detection-sort-by-number-not-id branch from 3c2b965 to d74ebde Compare February 26, 2025 08:45
@alanzirek alanzirek marked this pull request as ready for review February 26, 2025 08:51
@alanzirek alanzirek requested a review from Anto59290 February 26, 2025 08:51
sv/views.py Outdated
return (
Evenement.objects.all()
.annotate(first_detection_id=Min("detections__id"))
.annotate(first_detection_id=Subquery(first_detections_subquery))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Je ne sais pas dans quelle mesure ma remarque est liée uniquement à cette PR mais j'ai l'impression que first_detection_id ne sert que pour active_detection, pourquoi ne prend ton pas la première détection du queryset si celui ci est tri plutôt que d'annotate l'objet avec une subquery, est ce que ça ne serait pas plus performant ?

Copy link
Collaborator Author

@alanzirek alanzirek Feb 27, 2025

Choose a reason for hiding this comment

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

oui 👍 J'ai remplacé par un Prefetch qui précharge les détections déjà triées correctement + sélection de la 1ère détection via self.object.detections.first() (cf commit 84d2ebd).
J'ai aussi ajouté un test l'affichage des détections triées par numéro et non par id.

@alanzirek alanzirek requested a review from Anto59290 February 27, 2025 22:45
@alanzirek alanzirek force-pushed the detection-sort-by-number-not-id branch 2 times, most recently from 36b41f7 to 51dccba Compare February 28, 2025 09:40
- Sélectionner la première fiche de détection par numéro et non par ID dans la vue détail événement
-  MAJ des tests avec factories
  * Remplacement de baker par des factories dans quelques tests
  * Ajout d'une méthode create_miniaml pour créer une factory Lieu ou Prelevement avec uniquement les champs obligatoires
  * Ajout de la factory PosistionChaineDistribution
@alanzirek alanzirek force-pushed the detection-sort-by-number-not-id branch from 51dccba to 12d6916 Compare February 28, 2025 09:41
@alanzirek alanzirek merged commit 6112a8a into main Feb 28, 2025
5 of 6 checks passed
@alanzirek alanzirek deleted the detection-sort-by-number-not-id branch February 28, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants