Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

docs(API Stats): Ajout des filtres dans la documentation #5091

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

qloridant
Copy link
Collaborator

No description provided.

@qloridant qloridant marked this pull request as ready for review March 4, 2025 16:25
@github-actions github-actions bot requested review from Charline-L and raphodn March 4, 2025 16:25
include_in_documentation = True
serializer_class = CanteenStatisticsSerializer

@extend_schema(
Copy link
Member

Choose a reason for hiding this comment

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

j'ai un peu re-regardé pour utiliser des filterset_class, mais ca semble effectivement nécessairement rattaché à un model, et ca va filtrer le queryset en amont de la view. donc OpenApiParameter it is..

@@ -40,11 +53,11 @@ def get(self, request):
canteens = self._filter_canteens(regions, departments, city_insee_codes, sector_categories)
diagnostics = self._filter_diagnostics(year, regions, departments, city_insee_codes, sector_categories)

data = CanteenStatisticsSerializer.calculate_statistics(canteens, diagnostics)
data = self.serializer_class.calculate_statistics(canteens, diagnostics)
Copy link
Member

Choose a reason for hiding this comment

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

je ne sais pas si t'as prévu des refacto supplémentaires, mais sortir calculate_statistics de CanteenStatisticsSerializer serait une bonne chose je pense (réduire au max la logique dans les serializer, pour la basculer dans les modèles ou des utils, et à la rigueur la view)


@extend_schema(
parameters=[
OpenApiParameter(name="year", type=str, description="Filter by year of declared data", required=True),
Copy link
Member

Choose a reason for hiding this comment

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

dans l'UI il les classe par ordre alphabétique on dirait

@raphodn raphodn merged commit bc95447 into staging Mar 5, 2025
9 checks passed
@raphodn raphodn deleted the qloridant/doc-api-statistique branch March 5, 2025 08:46
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants