diff --git a/fournée/core/templatetags/fournée_modify.py b/fournée/core/templatetags/fournée_modify.py index ec4983d..b271880 100644 --- a/fournée/core/templatetags/fournée_modify.py +++ b/fournée/core/templatetags/fournée_modify.py @@ -17,6 +17,10 @@ def submit_row_tag(parser, token): def emballe(quantité, fourniture): quotient = quantité // fourniture.conditionnement reste = quantité % fourniture.conditionnement + if not reste and quotient == 1: + return f"{quotient} {fourniture.emballage}" + if not reste and quotient > 1: + return f"{quotient} {fourniture.emballage}s" if not quotient and reste < fourniture.conditionnement/2: return None if quotient == 1 and reste < fourniture.conditionnement/2: