diff --git a/barker/barker/routers/reports/product_sale_report.py b/barker/barker/routers/reports/product_sale_report.py index facc981..e183274 100644 --- a/barker/barker/routers/reports/product_sale_report.py +++ b/barker/barker/routers/reports/product_sale_report.py @@ -89,7 +89,9 @@ def product_sale_report(s: date, f: date, db: Session): type_ = to_camel(VoucherType(type_).name) old = [i for i in info if i["id"] == id_ and i["isHappyHour"] == hh] if len(old): - old[0][type_] = quantity + if type_ not in old[0]: + old[0][type_] = 0 + old[0][type_] += quantity else: info.append( {