mirror of
https://github.com/Sea-Haven-Industries/meal-order-manager.git
synced 2026-10-06 10:01:58 +00:00
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:
parent
526b768267
commit
53a1e503b3
1 changed files with 8 additions and 6 deletions
|
|
@ -110,12 +110,14 @@ def delete_order(week: str, employee_slug: str):
|
||||||
|
|
||||||
def put_summary(week: str, summary: dict):
|
def put_summary(week: str, summary: dict):
|
||||||
_get_table().put_item(
|
_get_table().put_item(
|
||||||
Item={
|
Item=_to_decimal(
|
||||||
"PK": f"WEEK#{week}",
|
{
|
||||||
"SK": "SUMMARY",
|
"PK": f"WEEK#{week}",
|
||||||
"ttl": ttl_days(90),
|
"SK": "SUMMARY",
|
||||||
**summary,
|
"ttl": ttl_days(90),
|
||||||
}
|
**summary,
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue