fix: 完善报工归属输出安全性

This commit is contained in:
souplearn
2026-07-25 04:39:25 +08:00
parent b0cb217ce3
commit bb9ce5601c
4 changed files with 239 additions and 10 deletions
+5
View File
@@ -192,6 +192,7 @@ def _dashboard_rows(
"product_name": item.product_name,
"process_name": process_name,
"report_ids": set(),
"source_report_dates": set(),
"effective_minutes": 0.0,
"shift_day_minutes": 0.0,
"shift_overtime_minutes": 0.0,
@@ -230,6 +231,7 @@ def _dashboard_rows(
allocated_minutes = 0 if is_cleaning else (as_float(item.allocated_minutes) or fallback_minutes)
expected_workload = allocated_minutes * 60 / standard_beat if standard_beat > 0 else 0
group["report_ids"].add(report.id)
group["source_report_dates"].add(report.report_date)
group["effective_minutes"] += allocated_minutes
group["expected_workload"] += expected_workload
group["shift_day_minutes"] += as_float(getattr(item, "_shift_day_minutes", 0))
@@ -277,11 +279,14 @@ def _dashboard_rows(
"overtime": group["shift_overtime_minutes"],
"night": group["shift_night_minutes"],
}
source_report_dates = sorted(group["source_report_dates"])
rows.append(
DashboardRow(
id=group["id"],
attendance_point_name=group["attendance_point_name"],
report_date=group["report_date"],
source_report_date=source_report_dates[-1] if source_report_dates else group["report_date"],
source_report_dates=source_report_dates,
employee_phone=group["employee_phone"],
employee_name=group["employee_name"],
worker_type=group["worker_type"],