-
Notifications
You must be signed in to change notification settings - Fork 11
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
refactor(ETL): Utilser QuerySet et Serializer pour publier les cantines dans Metabase #4884
Conversation
…s sur Metabase afin d utiliser le serializer.
api/serializers/canteen.py
Outdated
@@ -529,6 +532,8 @@ def get_is_managed_by_user(self, obj): | |||
|
|||
# remember to update TD version if you update this | |||
class CanteenTeledeclarationSerializer(serializers.ModelSerializer): | |||
geo_data = {"department": {i.value: i.label for i in Department}, "region": {i.value: i.label for i in Region}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utilisé ?
api/serializers/canteen.py
Outdated
|
||
|
||
class CanteenMetabaseSerializer(serializers.ModelSerializer): | ||
departments_lib = {i.value: i.label.split(" - ")[1] for i in Department} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pourquoi les rajouter à la class ? vu qu'ils sont déjà accessibles sous forme de constants dans un autre fichier
api/serializers/canteen.py
Outdated
return obj.department | ||
|
||
def get_departement_lib(self, obj): | ||
return self.departments_lib[obj.department] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plutôt rajouter une méthode coté department_choices.py
et y faire appel ici
(exemple similaire ci-dessous avec get_modele_economique
)
Co-authored-by: Raphaël Odini <raphodn@users.noreply.github.com>
Je propose que le refactor du map_sectors() soit pris en compte dans une prochaine PR (il va y en avoir plusieurs pour prendre en compte tous les jeux de données) Suite du refactor dont faudra discuter ensemble d'ailleurs |
…ma-cantine into 4756-refacto-queryset-opendata
…es dans Metabase (#4884) Co-authored-by: Raphaël Odini <raphodn@users.noreply.github.com>
No description provided.