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 <week> yet' -- even though
the PDF was sitting in S3.

Convert via _to_decimal in put_summary, matching put_order/put_settings.
This commit is contained in:
Adam Moussa 2026-06-12 15:00:04 -04:00
parent 526b768267
commit 53a1e503b3

View file

@ -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,
}
)
)