fix(capa): compute overdue status at render time in CAPA board page
This commit is contained in:
@@ -33,6 +33,7 @@ export default async function CapaListPage() {
|
|||||||
.orderBy(asc(capaActions.dueDate))
|
.orderBy(asc(capaActions.dueDate))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const today = new Date().toISOString().slice(0, 10)
|
||||||
const capas = rows.map(r => ({
|
const capas = rows.map(r => ({
|
||||||
id: r.id,
|
id: r.id,
|
||||||
incident_id: r.incidentId,
|
incident_id: r.incidentId,
|
||||||
@@ -40,7 +41,9 @@ export default async function CapaListPage() {
|
|||||||
department: r.department,
|
department: r.department,
|
||||||
due_date: r.dueDate,
|
due_date: r.dueDate,
|
||||||
priority: r.priority,
|
priority: r.priority,
|
||||||
status: r.status,
|
status: (r.status === 'open' || r.status === 'in_progress') && r.dueDate && r.dueDate < today
|
||||||
|
? 'overdue' as const
|
||||||
|
: r.status,
|
||||||
incidents: { reference_no: r.incidentRefNo ?? null },
|
incidents: { reference_no: r.incidentRefNo ?? null },
|
||||||
owner: r.ownerName ? { name: r.ownerName } : null,
|
owner: r.ownerName ? { name: r.ownerName } : null,
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user