From 53a1e503b3be044a724f78d08c03e947eb23c72c Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Fri, 12 Jun 2026 15:00:04 -0400 Subject: [PATCH] Fix put_summary float serialization so SUMMARY records persist aggregate_orders uploads the weekly PDF/CSVs to S3 and then calls put_summary(), but put_summary spread the summary dict (which contains float prices/totals) straight into put_item without Decimal conversion. boto3 rejects floats (TypeError: Float types are not supported), so the SUMMARY DynamoDB item was never written for any week (W20-W23). The summary-PDF download endpoint gates on get_summary(week), so it got None and returned 404 -- 'No summary PDF for yet' -- even though the PDF was sitting in S3. Convert via _to_decimal in put_summary, matching put_order/put_settings. --- src/shared/shared/db.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/shared/shared/db.py b/src/shared/shared/db.py index 6232dba..27502a9 100644 --- a/src/shared/shared/db.py +++ b/src/shared/shared/db.py @@ -110,12 +110,14 @@ def delete_order(week: str, employee_slug: str): def put_summary(week: str, summary: dict): _get_table().put_item( - Item={ - "PK": f"WEEK#{week}", - "SK": "SUMMARY", - "ttl": ttl_days(90), - **summary, - } + Item=_to_decimal( + { + "PK": f"WEEK#{week}", + "SK": "SUMMARY", + "ttl": ttl_days(90), + **summary, + } + ) )