Merge branch 'fix/production-result' into 'development'

[FIX/FE] Production Result

See merge request mbugroup/lti-web-client!240
This commit is contained in:
Rivaldi A N S
2026-01-23 09:01:27 +00:00
2 changed files with 40 additions and 35 deletions
+5
View File
@@ -31,6 +31,11 @@ export const formatNumber = (
}).format(value); }).format(value);
}; };
export const safeRound = (num: number, decimals: number) => {
const factor = 10 ** decimals;
return Math.round((num + Number.EPSILON) * factor) / factor;
};
export const formatTitleCase = (value: string) => { export const formatTitleCase = (value: string) => {
return value return value
.toLowerCase() .toLowerCase()
+35 -35
View File
@@ -1,6 +1,6 @@
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import toast from 'react-hot-toast'; import toast from 'react-hot-toast';
import { formatDate } from '@/lib/helper'; import { formatDate, safeRound } from '@/lib/helper';
import { isResponseSuccess } from '@/lib/api-helper'; import { isResponseSuccess } from '@/lib/api-helper';
import { BaseApiService } from '@/services/api/base'; import { BaseApiService } from '@/services/api/base';
import { httpClient, httpClientFetcher } from '@/services/http/client'; import { httpClient, httpClientFetcher } from '@/services/http/client';
@@ -68,41 +68,41 @@ export class ProductionResultReportApiService extends BaseApiService<
row.productionResult?.forEach((productionResult) => { row.productionResult?.forEach((productionResult) => {
groupedData[kandangName].push({ groupedData[kandangName].push({
woa: productionResult.woa, woa: safeRound(productionResult.woa, 2),
bw: productionResult.bw, bw: safeRound(productionResult.bw, 2),
std_bw: productionResult.std_bw, std_bw: safeRound(productionResult.std_bw, 2),
uniformity: productionResult.uniformity, uniformity: safeRound(productionResult.uniformity, 2),
std_uniformity: productionResult.std_uniformity, std_uniformity: productionResult.std_uniformity,
dep_kum: productionResult.dep_kum, dep_kum: safeRound(productionResult.dep_kum, 2),
dep_std: productionResult.dep_std, dep_std: safeRound(productionResult.dep_std, 2),
butiran_utuh: productionResult.butiran_utuh, butiran_utuh: safeRound(productionResult.butiran_utuh, 2),
butiran_putih: productionResult.butiran_putih, butiran_putih: safeRound(productionResult.butiran_putih, 2),
butiran_retak: productionResult.butiran_retak, butiran_retak: safeRound(productionResult.butiran_retak, 2),
butiran_pecah: productionResult.butiran_pecah, butiran_pecah: safeRound(productionResult.butiran_pecah, 2),
butiran_jumlah: productionResult.butiran_jumlah, butiran_jumlah: safeRound(productionResult.butiran_jumlah, 2),
total_butir: productionResult.total_butir, total_butir: safeRound(productionResult.total_butir, 2),
kg_utuh: productionResult.kg_utuh, kg_utuh: safeRound(productionResult.kg_utuh, 2),
kg_putih: productionResult.kg_putih, kg_putih: safeRound(productionResult.kg_putih, 2),
kg_retak: productionResult.kg_retak, kg_retak: safeRound(productionResult.kg_retak, 2),
kg_pecah: productionResult.kg_pecah, kg_pecah: safeRound(productionResult.kg_pecah, 2),
kg_jumlah: productionResult.kg_jumlah, kg_jumlah: safeRound(productionResult.kg_jumlah, 2),
total_kg: productionResult.total_kg, total_kg: safeRound(productionResult.total_kg, 2),
persen_utuh: productionResult.persen_utuh, persen_utuh: safeRound(productionResult.persen_utuh, 2),
persen_putih: productionResult.persen_putih, persen_putih: safeRound(productionResult.persen_putih, 2),
persen_retak: productionResult.persen_retak, persen_retak: safeRound(productionResult.persen_retak, 2),
persen_pecah: productionResult.persen_pecah, persen_pecah: safeRound(productionResult.persen_pecah, 2),
hd: productionResult.hd, hd: safeRound(productionResult.hd, 2),
hd_std: productionResult.hd_std, hd_std: safeRound(productionResult.hd_std, 2),
fi: productionResult.fi, fi: safeRound(productionResult.fi, 2),
fi_std: productionResult.fi_std, fi_std: safeRound(productionResult.fi_std, 2),
em: productionResult.em, em: safeRound(productionResult.em, 2),
em_std: productionResult.em_std, em_std: safeRound(productionResult.em_std, 2),
ew: productionResult.ew, ew: safeRound(productionResult.ew, 2),
ew_std: productionResult.ew_std, ew_std: safeRound(productionResult.ew_std, 2),
fcr: productionResult.fcr, fcr: safeRound(productionResult.fcr, 2),
fcr_std: productionResult.fcr_std, fcr_std: safeRound(productionResult.fcr_std, 2),
hh: productionResult.hh, hh: safeRound(productionResult.hh, 2),
hh_std: productionResult.hh_std, hh_std: safeRound(productionResult.hh_std, 2),
project_flock_name: project_flock_name:
row.projectFlockKandang.project_flock.flock_name, row.projectFlockKandang.project_flock.flock_name,
project_flock_category: project_flock_category: