From 65d35281b2b33f12a02b4a73fed1b8c45ba8df44 Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:59:52 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20DynamoDB=20float=20error=20=E2=80=94=20us?= =?UTF-8?q?e=20Decimal=20for=20pay=20records?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/weekly_post.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/weekly_post.py b/src/weekly_post.py index db74056..27b6a2b 100644 --- a/src/weekly_post.py +++ b/src/weekly_post.py @@ -4,6 +4,7 @@ to Slack every Monday at 7am ET, and emails the pay summary to payroll.""" import logging import os from datetime import datetime, timedelta +from decimal import Decimal from zoneinfo import ZoneInfo import boto3 @@ -40,13 +41,13 @@ def _add_shift_to_pay(schedule, breakdown, totals, date, day_name, shift_type="n "day": f"{day_name[:3]}{label_suffix}", "name": name, "extension": ext, - "rate": rate, + "rate": Decimal(str(rate)), }) if name not in totals: - totals[name] = {"shifts": 0, "total": 0.0, "extension": ext, "rate": rate} + totals[name] = {"shifts": 0, "total": Decimal("0"), "extension": ext, "rate": Decimal(str(rate))} totals[name]["shifts"] += 1 - totals[name]["total"] += rate + totals[name]["total"] += Decimal(str(rate)) def _calculate_weekly_pay(schedule: ShiftSchedule, week_start: datetime) -> dict: