update kpi mortality card to change color based on the status
This commit is contained in:
1 parent
cceaf38a25
commit
3fdd9b936f
3 files changed
+105
-1
No files matched your search
@@ -21,6 +21,7 @@ import {
|
||||
} from '../utils/format.ts';
|
||||
import { throughVisibleDate } from '../utils/visibility.ts';
|
||||
import { getCountingAccuracyWarning } from '../utils/countingAccuracyWarning.ts';
|
||||
import { getDailyMortalityStatus } from '../utils/mortality.ts';
|
||||
import {
|
||||
buildDashboardInsightContext,
|
||||
buildDashboardInsightMetrics,
|
||||
@@ -176,6 +177,8 @@ const Dashboard: React.FC<Props> = ({ setView }) => {
|
||||
}));
|
||||
const age = latest?.age ?? null;
|
||||
const mortalityToday = latest?.mortality ?? null;
|
||||
const docInCount = selectedCycle?.doc_in_count ?? null;
|
||||
const mortalityStatus = getDailyMortalityStatus(mortalityToday, docInCount);
|
||||
const feedToday = latest != null ? latest.feed : null;
|
||||
const weightToday =
|
||||
latest && latest.iot_weight > 0
|
||||
@@ -198,7 +201,7 @@ const Dashboard: React.FC<Props> = ({ setView }) => {
|
||||
unit: 'ekor',
|
||||
icon: '📉',
|
||||
trend: mortalityTrend,
|
||||
status: mortalityToday == null ? 'na' : 'ok',
|
||||
status: mortalityStatus,
|
||||
targetView: 'dataManagement',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user