ai insight rework #2
This commit is contained in:
1 parent
9d76f54d33
commit
e1987d6999
39 files changed
+2311
-830
No files matched your search
+5
-23
@@ -1,11 +1,6 @@
|
||||
import ExcelJS from 'exceljs';
|
||||
import type { DashboardReportPayload } from '../types/dashboardReport.ts';
|
||||
import {
|
||||
countingTotals,
|
||||
feedInTotals,
|
||||
feedOutTotals,
|
||||
feedUseTotals,
|
||||
} from './reportTotals.ts';
|
||||
import { countingTotals, feedInTotals, feedOutTotals, feedUseTotals } from './reportTotals.ts';
|
||||
import { formatDateId, formatDateRange, formatNumber, formatRatio } from './format.ts';
|
||||
import { buildReportSummary, formatSummaryValue } from './reportSummary.ts';
|
||||
|
||||
@@ -34,11 +29,9 @@ type CellValue = string | number | null;
|
||||
const isPresent = (value: number | null | undefined): value is number =>
|
||||
typeof value === 'number' && Number.isFinite(value);
|
||||
|
||||
const dash = (value: number | null | undefined): CellValue =>
|
||||
isPresent(value) ? value : '-';
|
||||
const dash = (value: number | null | undefined): CellValue => (isPresent(value) ? value : '-');
|
||||
|
||||
const na = (value: number | null | undefined): CellValue =>
|
||||
isPresent(value) ? value : 'N/A';
|
||||
const na = (value: number | null | undefined): CellValue => (isPresent(value) ? value : 'N/A');
|
||||
|
||||
const pct = (value: number | null | undefined): CellValue =>
|
||||
isPresent(value) ? `${value.toFixed(1)}%` : 'N/A';
|
||||
@@ -242,11 +235,7 @@ function addSummarySheet(workbook: ExcelJS.Workbook, payload: DashboardReportPay
|
||||
sheet.addRow([]);
|
||||
insertedHighlightGap = true;
|
||||
}
|
||||
const row = sheet.addRow([
|
||||
metric.label,
|
||||
formatSummaryValue(metric),
|
||||
metric.unit || '—',
|
||||
]);
|
||||
const row = sheet.addRow([metric.label, formatSummaryValue(metric), metric.unit || '—']);
|
||||
if (isHighlight) {
|
||||
styleHighlightKpiRow(row, 3);
|
||||
} else {
|
||||
@@ -433,14 +422,7 @@ export async function downloadReportExcel(payload: DashboardReportPayload): Prom
|
||||
addTable(
|
||||
workbook.addWorksheet('EEF'),
|
||||
'Data Pendukung EEF',
|
||||
[
|
||||
'Umur',
|
||||
'Persentase Ayam Hidup',
|
||||
'BW Rata-rata Panen',
|
||||
'Umur Rata-rata Panen',
|
||||
'FCR',
|
||||
'EEF',
|
||||
],
|
||||
['Umur', 'Persentase Ayam Hidup', 'BW Rata-rata Panen', 'Umur Rata-rata Panen', 'FCR', 'EEF'],
|
||||
payload.eef.map((row) => [
|
||||
`Hari ${row.day}`,
|
||||
qty(row.chickenLifePercentage, 3, '%'),
|
||||
|
||||
Reference in new issue
Block a user