fix main dashboard showing population instead of mortality

This commit is contained in:
Alberto-Audrix committed 2026-09-02 10:38:58 +07:00
1 parent b42fe1b3cf
commit b8c11ad76a
1 file changed
+8 -7
+8 -7
View File
@@ -93,7 +93,8 @@ const Dashboard: React.FC<Props> = ({ setView }) => {
const latest = kpis[0];
const fcrTrend = chronological(kpis).map((row) => row.fcr);
const eefTrend = chronological(kpis).map((row) => row.eef);
const popTrend = chronological(countings).map((row) => row.total_count);
const mortalityTrend = chronological(countings).map((row) => row.mortality_count);
const mortalityToday = latest?.mortality ?? countings[0]?.mortality_count ?? null;
const weightTrend = chronological(weights).map((row) => row.average_weight);
const age = selectedCycle?.current_day ?? latest?.age ?? null;
return [
@@ -106,13 +107,13 @@ const Dashboard: React.FC<Props> = ({ setView }) => {
status: age == null ? 'na' : 'ok',
},
{
key: 'populasi',
title: 'Populasi',
value: latest?.chicken_life ?? countings[0]?.total_count ?? null,
key: 'mortality',
title: 'Mortalitas',
value: mortalityToday,
unit: 'ekor',
icon: '🐔',
trend: popTrend,
status: 'ok',
icon: '📉',
trend: mortalityTrend,
status: mortalityToday == null ? 'na' : 'ok',
targetView: 'dataManagement',
},
{