mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-10-04 21:52:07 +00:00
Fix DynamoDB float error — use Decimal for pay records
This commit is contained in:
parent
f8ceb1dc83
commit
65d35281b2
1 changed files with 4 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ to Slack every Monday at 7am ET, and emails the pay summary to payroll."""
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from decimal import Decimal
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
import boto3
|
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}",
|
"day": f"{day_name[:3]}{label_suffix}",
|
||||||
"name": name,
|
"name": name,
|
||||||
"extension": ext,
|
"extension": ext,
|
||||||
"rate": rate,
|
"rate": Decimal(str(rate)),
|
||||||
})
|
})
|
||||||
|
|
||||||
if name not in totals:
|
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]["shifts"] += 1
|
||||||
totals[name]["total"] += rate
|
totals[name]["total"] += Decimal(str(rate))
|
||||||
|
|
||||||
|
|
||||||
def _calculate_weekly_pay(schedule: ShiftSchedule, week_start: datetime) -> dict:
|
def _calculate_weekly_pay(schedule: ShiftSchedule, week_start: datetime) -> dict:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue