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

[FIX/FE] Production Result

See merge request mbugroup/lti-web-client!239
This commit is contained in:
Rivaldi A N S
2026-01-23 08:37:32 +00:00
+11 -9
View File
@@ -32,21 +32,21 @@ export class ProductionResultReportApiService extends BaseApiService<
const mappedProductionResults: { const mappedProductionResults: {
projectFlockKandang: BaseProjectFlockKandang; projectFlockKandang: BaseProjectFlockKandang;
productionResult: ProductionResult[] | null; productionResult: ProductionResult[] | null;
}[] = []; }[] = await Promise.all(
(projectFlockKandangs || []).map(async (projectFlockKandang) => {
projectFlockKandangs?.forEach(async (projectFlockKandang) => {
const getProductionResultPath = `${this.basePath}/${projectFlockKandang.id}?page=1&limit=99999999`; const getProductionResultPath = `${this.basePath}/${projectFlockKandang.id}?page=1&limit=99999999`;
const getProductionResultRes = await httpClient< const getProductionResultRes = await httpClient<
BaseApiResponse<ProductionResult[]> BaseApiResponse<ProductionResult[]>
>(getProductionResultPath); >(getProductionResultPath);
mappedProductionResults.push({ return {
projectFlockKandang, projectFlockKandang,
productionResult: isResponseSuccess(getProductionResultRes) productionResult: isResponseSuccess(getProductionResultRes)
? getProductionResultRes.data ? getProductionResultRes.data
: null, : null,
}); };
}); })
);
const rows = mappedProductionResults; const rows = mappedProductionResults;
if (!rows || rows.length === 0) { if (!rows || rows.length === 0) {
@@ -103,9 +103,11 @@ export class ProductionResultReportApiService extends BaseApiService<
fcr_std: productionResult.fcr_std, fcr_std: productionResult.fcr_std,
hh: productionResult.hh, hh: productionResult.hh,
hh_std: productionResult.hh_std, hh_std: productionResult.hh_std,
project_flock_name: productionResult.project_flock.name, project_flock_name:
project_flock_category: productionResult.project_flock.category, row.projectFlockKandang.project_flock.flock_name,
kandang_name: productionResult.project_flock.kandang.name, project_flock_category:
row.projectFlockKandang.project_flock.category,
kandang_name: row.projectFlockKandang.kandang.name,
created_at: formatDate(productionResult.created_at, 'YYYY-MM-DD'), created_at: formatDate(productionResult.created_at, 'YYYY-MM-DD'),
updated_at: formatDate(productionResult.updated_at, 'YYYY-MM-DD'), updated_at: formatDate(productionResult.updated_at, 'YYYY-MM-DD'),
}); });