-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(Open Data): Ajout de champs manquants pour les déclarations #1475
feat(Open Data): Ajout de champs manquants pour les déclarations #1475
Conversation
for declared_ingredient in obj.declared_ingredients.filter(ingredient__ingredient_type=5) | ||
] | ||
|
||
def get_date_decision(self, obj): |
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.
Je te remets ici le commentaires de mattermost
@property
def acceptation_date(self):
if status != "AUTHORIZED":
return None
try:
latest_snapshot = self.snapshots.latest(
"creation_date"
)
return latest_snapshot.creation_date
except Snapshot.DoesNotExist:
return None
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.
Done c92d089
(avec qq modifs de code)
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.
Quelques changements nécesaires :
- sur
get_article_reference
- sur
get_acceptation_date
Le reste c'est juste des petites remarques.
Je suis dispo si tu veux en discuter.
api/serializers/declaration.py
Outdated
"declared_microorganisms", | ||
"declared_substances", | ||
"modification_date", | ||
"article_reference", |
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.
j'ai vu que ça s'appellait aussi "procédure" dans TeleIcare.
Peut-être que "article_procedure" pourrait mieux marcher.
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.
Ok !
770aa98
def get_marque(self, obj): | ||
return obj.brand | ||
|
||
def get_gamme(self, obj): |
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.
cette méthode n'est pas obligatoire (comme le nom du champ et le nom du champ traduit sont les mêmes).
mais tu l'as peut être laissée pour la lisibilité ?
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.
Oui ! Mais je peux supprimer :)
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.
Dans le doute j'ai documenté son caractère inutile en terme de code
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.
@@ -337,13 +379,34 @@ def get_article(self, obj): | |||
else: |
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.
je n'avais pas vu ça passer la dernière fois, désolée.
Pour l'article on va utiliser plutôt le champ article
qui est un GeneratedField (à partir de calculated_article
et overriden_article
, qui prévaut sur calculated_article
).
Donc il faut plutôt appeler
if "Article 15" in obj.get_article_display():
return "Article 15"
else:
return obj.get_article_display()
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.
Il me reste une interrogation sur le champ
date_decision