ai insight rework #2

This commit is contained in:
Alberto-Audrix committed 2026-10-01 13:23:45 +07:00
1 parent 9d76f54d33
commit e1987d6999
39 files changed
+2311 -830

No files matched your search

+5 -13
View File
@@ -140,8 +140,7 @@ const DataManagementPage: React.FC<{ onSettings: () => void }> = ({ onSettings }
const panen = manual?.harvest_manual ?? kpi?.harvest ?? 0;
// Database menyimpan berat panen dalam gram; tampilkan selalu dalam kg.
const beratPanen = (manual?.harvest_weight_manual ?? kpi?.harvest_weight ?? 0) / 1000;
const stockAkhir =
stockAkhirFromKpi(kpi) ?? Math.max(0, stockAwal - mati - panen);
const stockAkhir = stockAkhirFromKpi(kpi) ?? Math.max(0, stockAwal - mati - panen);
const chickenCount = counting?.total_count;
// Akurasi Chicken Counting (IOT) terhadap stock akhir manual:
@@ -192,8 +191,7 @@ const DataManagementPage: React.FC<{ onSettings: () => void }> = ({ onSettings }
const totalPanen = latest?.harvestTotal ?? 0;
const totalBeratPanen = latest?.harvestWeightTotal ?? 0;
const currentPopulation = latest?.stockAkhir ?? initialPopulation;
const mortalityRate =
initialPopulation > 0 ? (totalMortality / initialPopulation) * 100 : null;
const mortalityRate = initialPopulation > 0 ? (totalMortality / initialPopulation) * 100 : null;
return {
initialPopulation,
@@ -212,16 +210,13 @@ const DataManagementPage: React.FC<{ onSettings: () => void }> = ({ onSettings }
const lastKpiAge = kpis.length > 0 ? Math.max(...kpis.map((k) => k.age)) : null;
const lastCountingDay =
countings.length > 0
? Math.max(
...countings.map((c) => cycleDayForDate(selectedCycle.start_date, c.date))
)
? Math.max(...countings.map((c) => cycleDayForDate(selectedCycle.start_date, c.date)))
: null;
const lastDataDay =
lastKpiAge != null || lastCountingDay != null
? Math.max(lastKpiAge ?? 0, lastCountingDay ?? 0)
: null;
const insightRows =
lastDataDay != null ? rows.filter((row) => row.day <= lastDataDay) : rows;
const insightRows = lastDataDay != null ? rows.filter((row) => row.day <= lastDataDay) : rows;
return buildCountingInsightContext({
kandangId: selectedKandang.id,
kandangName: selectedKandang.kandang_name,
@@ -761,10 +756,7 @@ const DataManagementPage: React.FC<{ onSettings: () => void }> = ({ onSettings }
<tbody className="divide-y divide-gray-200">
{filteredRecords.length === 0 ? (
<tr>
<td
colSpan={11}
className="px-6 py-12 text-center text-gray-500"
>
<td colSpan={11} className="px-6 py-12 text-center text-gray-500">
<i className="fa-solid fa-inbox text-4xl mb-3 block text-gray-300"></i>
Tidak ada data yang ditemukan
</td>