diff --git a/src/configs/version.configs.js b/src/configs/version.configs.js index bbe4ad5..a530202 100644 --- a/src/configs/version.configs.js +++ b/src/configs/version.configs.js @@ -1,6 +1,6 @@ const version = { api: ['/api/v1/','/api/v2'], - app: '2023.7.3' + app: '2023.7.4' }; module.exports = version; \ No newline at end of file diff --git a/src/services/trainService.services.js b/src/services/trainService.services.js index 7f15248..55e1c7f 100644 --- a/src/services/trainService.services.js +++ b/src/services/trainService.services.js @@ -20,14 +20,14 @@ async function findByHeadcodeToday(headcode) { let trainData = await parseTrains(queryData); let preparedData = []; for (let trainService in trainData) { - if (trainData /* CONDTION NEEDS CHANGIN WHEN DBMAN UPDATED /*pis.supported.includes(trainData?.operator)*/) { + if (pis.supported.includes(trainData[trainService]['operator'])) { // Search for PIS Code for each service const tiplocList = await getPublicStops(trainData[trainService]['stops']); //console.log(tiplocList.length); console.log(tiplocList); if (tiplocList.length) { const pisDetail = await pis.findByTiplocArray(tiplocList); trainData[trainService]['pis'] = pisDetail?.[0]?.['code'] ?? 'None'; - } else { + } else if (trainData[trainService]['operator'] === 'GW') { trainData[trainService]['pis'] = '0015'; // Not in Service code // '0015' is a string becuase 0015 is not a valid number.. } @@ -61,13 +61,13 @@ async function findByHeadcode(date, headcode) { let preparedData = []; for (let trainService in trainData) { // Search for PIS Code for each service if supported by PIS services - if (pis.supported.includes(trainData?.operator)) { + if (pis.supported.includes(trainData[trainService]['operator'])) { const tiplocList = await getPublicStops(trainData[trainService]['stops']); //console.log(tiplocList.length); console.log(tiplocList); if (tiplocList.length) { const pisDetail = await pis.findByTiplocArray(tiplocList); trainData[trainService]['pis'] = pisDetail?.[0]?.['code'] ?? 'None'; - } else if (trainData?.operator === 'GW' && !tiplocList.length) { + } else if (trainData[trainService]['operator'] === 'GW' && !tiplocList.length) { // Not in Service code - for GWR Only trainData[trainService]['pis'] = '0015'; }