import { MultiCoopWeightData } from '../types'; // Data sourced from: https://dashboard.cpsp.id/api/scales/cage/9f556d2a-af5c-41b0-bcd0-6cea0dfa0fed const apiKpiData = { '0': { ref_weight: 37, manual_weight: 37, iot_weight: 37 }, '1': { ref_weight: 45, manual_weight: 54.5, iot_weight: 53.7 }, '2': { ref_weight: 65, manual_weight: 63.0, iot_weight: 61.16 }, '3': { ref_weight: 84, manual_weight: 80.5, iot_weight: 76.39 }, '4': { ref_weight: 106, manual_weight: 94.0, iot_weight: 103.76 }, '5': { ref_weight: 133, manual_weight: 109.0, iot_weight: 134.06 }, '6': { ref_weight: 159, manual_weight: 124.0, iot_weight: 133.96 }, '7': { ref_weight: 187, manual_weight: 168.5, iot_weight: 163.87 }, '8': { ref_weight: 217, manual_weight: 187.0, iot_weight: 206.36 }, '9': { ref_weight: 251, manual_weight: 208.0, iot_weight: 1006.0 }, '10': { ref_weight: 294, manual_weight: 243.5, iot_weight: 248.08 }, '11': { ref_weight: 340, manual_weight: 278.66, iot_weight: 315.46 }, '12': { ref_weight: 385, manual_weight: 312.0, iot_weight: 398.1 }, '13': { ref_weight: 432, manual_weight: 357.0, iot_weight: 394.96 }, '14': { ref_weight: 489, manual_weight: 428.33, iot_weight: 488.56 }, '15': { ref_weight: 550, manual_weight: 490.33, iot_weight: 572.76 }, '16': { ref_weight: 609, manual_weight: 550.75, iot_weight: 667.09 }, '17': { ref_weight: 672, manual_weight: 561.75, iot_weight: 739.55 }, '18': { ref_weight: 741, manual_weight: 685.25, iot_weight: 747.88 }, '19': { ref_weight: 808, manual_weight: 762.5, iot_weight: 781.66 }, '20': { ref_weight: 881, manual_weight: 835.0, iot_weight: 887.05 }, '21': { ref_weight: 960, manual_weight: 902.5, iot_weight: 951.08 }, '22': { ref_weight: 1054, manual_weight: 972.5, iot_weight: 1046.32 }, '23': { ref_weight: 1132, manual_weight: 1110.0, iot_weight: 1124.33 }, '24': { ref_weight: 1213, manual_weight: 1110.0, iot_weight: 1325.56 }, '25': { ref_weight: 1296, manual_weight: 1217.5, iot_weight: 1376.98 }, '26': { ref_weight: 1382, manual_weight: 1307.5, iot_weight: 1366.27 }, '27': { ref_weight: 1473, manual_weight: 1392.5, iot_weight: 1497.0 }, '28': { ref_weight: 1569, manual_weight: 1457.5, iot_weight: 0.0 }, '29': { ref_weight: 1676, manual_weight: 1590.0, iot_weight: 0.0 }, '30': { ref_weight: 1768, manual_weight: 1692.5, iot_weight: 0.0 }, '31': { ref_weight: 1863, manual_weight: 1785.0, iot_weight: 0.0 }, '32': { ref_weight: 1961, manual_weight: 1830.0, iot_weight: 0.0 }, '33': { ref_weight: 2058, manual_weight: 1915.0, iot_weight: 0.0 }, '34': { ref_weight: 2159, manual_weight: 2002.5, iot_weight: 0.0 }, '35': { ref_weight: 2266, manual_weight: 0, iot_weight: 0 }, }; const targetHistory: { day: number; weight: number }[] = []; const manualHistory: { day: number; weight: number }[] = []; const iotHistory: { day: number; weight: number }[] = []; for (const dayStr in apiKpiData) { const day = parseInt(dayStr, 10); const dayData = apiKpiData[dayStr as keyof typeof apiKpiData]; // Only add data if it's a valid number greater than 0 if (dayData.ref_weight > 0) { targetHistory.push({ day, weight: Math.round(dayData.ref_weight) }); } if (dayData.manual_weight > 0) { manualHistory.push({ day, weight: Math.round(dayData.manual_weight) }); } if (dayData.iot_weight > 0) { iotHistory.push({ day, weight: Math.round(dayData.iot_weight) }); } } export const initialMultiCoopWeightData: { target: { day: number; weight: number }[]; coops: MultiCoopWeightData[]; } = { target: targetHistory, coops: [ { coopId: 'coop-manual', coopName: 'Manual (Sukawarna)', history: manualHistory, }, { coopId: 'coop-iot', coopName: 'Otomatis (Sukawarna)', history: iotHistory, }, ], };