Fix ECS PIS Code missing
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
6498f68bdf
commit
df0eb0451f
@ -1,6 +1,6 @@
|
|||||||
const version = {
|
const version = {
|
||||||
api: ['/api/v1/','/api/v2'],
|
api: ['/api/v1/','/api/v2'],
|
||||||
app: '2023.7.6'
|
app: '2023.7.7'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = version;
|
module.exports = version;
|
@ -30,7 +30,7 @@ async function get(req, res, next) {
|
|||||||
case 'headcode':
|
case 'headcode':
|
||||||
res.json(await train.findByHeadcode(date, id));
|
res.json(await train.findByHeadcode(date, id));
|
||||||
break;
|
break;
|
||||||
case 'trainuid':
|
case 'byTrainUid':
|
||||||
res.json(await train.findByTrainUid(id, date));
|
res.json(await train.findByTrainUid(id, date));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -103,10 +103,12 @@ async function findByTrainUid(uid, date = new Date()) {
|
|||||||
let publicStops;
|
let publicStops;
|
||||||
if (pis.supported.includes(services[0]?.operator)) {
|
if (pis.supported.includes(services[0]?.operator)) {
|
||||||
publicStops = await getPublicStops(services[0]?.stops);
|
publicStops = await getPublicStops(services[0]?.stops);
|
||||||
const pisCode = await pis.findByTiplocArray(publicStops);
|
if (publicStops.length) {
|
||||||
services[0].pis = pisCode[0]?.code;
|
const pisCode = await pis.findByTiplocArray(publicStops);
|
||||||
} else if ( services[0]?.operator === 'GW' && !publicStops.length) {
|
services[0].pis = pisCode[0]?.code;
|
||||||
services[0].pis = '0015';
|
} else if ( services[0]?.operator === 'GW' && !publicStops.length) {
|
||||||
|
services[0].pis = '0015';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return services[0];
|
return services[0];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user