Skip to content

Commit

Permalink
Permetter aux micro-organismes inactivés d apparaître
Browse files Browse the repository at this point in the history
  • Loading branch information
qloridant committed Dec 1, 2024
1 parent 9dc521a commit 49fe562
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions api/serializers/declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,20 +369,17 @@ def get_declared_plants(self, obj):
for declared_plant in obj.declared_plants.filter(active=True)
]

def get_declared_microorganisms(self, obj):
def get_declared_ingredients(self, obj):
return [
{
"genre": declared_microorganism.microorganism.genus,
"espece": declared_microorganism.microorganism.species,
"souche": declared_microorganism.strain,
"quantité_par_djr": declared_microorganism.quantity,
"souche": declared_microorganism.strain
if declared_microorganism.strain
else None, # elle est normalement obligatoire mais quelques entrées ont pu être rentrées avant le required
"quantité_par_djr": declared_microorganism.quantity if declared_microorganism.activated else None,
"inactive": not declared_microorganism.activated,
}
if declared_microorganism.microorganism
and declared_microorganism.strain
and declared_microorganism.quantity
and declared_microorganism.activated
else {}
for declared_microorganism in obj.declared_microorganisms.all()
]

Expand Down

0 comments on commit 49fe562

Please sign in to comment.