From 3a3c4bb5ccb04499071bc1492d8d7da63572272e Mon Sep 17 00:00:00 2001 From: Alejandro MG Date: Tue, 12 Sep 2023 17:51:58 +0200 Subject: [PATCH] Includes empty strings in non-egalim characteristics purchase summary --- api/views/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/views/purchase.py b/api/views/purchase.py index 5aba60c6e..790c5f932 100644 --- a/api/views/purchase.py +++ b/api/views/purchase.py @@ -328,7 +328,7 @@ def complete_diag_data(purchases, data): other_labels_characteristics.append(characteristic) # Non-EGAlim totals: contains no labels or only one or more of other_labels non_egalim_purchases = purchase_family.filter( - Q(characteristics__contained_by=other_labels_characteristics) | Q(characteristics__len=0) + Q(characteristics__contained_by=(other_labels_characteristics + [""])) | Q(characteristics__len=0) ).distinct() key = "value_" + family.lower() + "_non_egalim" data[key] = non_egalim_purchases.aggregate(total=Sum("price_ht"))["total"] or 0