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 = {
|
||||
api: ['/api/v1/','/api/v2'],
|
||||
app: '2023.7.6'
|
||||
app: '2023.7.7'
|
||||
};
|
||||
|
||||
module.exports = version;
|
@ -30,7 +30,7 @@ async function get(req, res, next) {
|
||||
case 'headcode':
|
||||
res.json(await train.findByHeadcode(date, id));
|
||||
break;
|
||||
case 'trainuid':
|
||||
case 'byTrainUid':
|
||||
res.json(await train.findByTrainUid(id, date));
|
||||
break;
|
||||
default:
|
||||
|
@ -103,10 +103,12 @@ async function findByTrainUid(uid, date = new Date()) {
|
||||
let publicStops;
|
||||
if (pis.supported.includes(services[0]?.operator)) {
|
||||
publicStops = await getPublicStops(services[0]?.stops);
|
||||
const pisCode = await pis.findByTiplocArray(publicStops);
|
||||
services[0].pis = pisCode[0]?.code;
|
||||
} else if ( services[0]?.operator === 'GW' && !publicStops.length) {
|
||||
services[0].pis = '0015';
|
||||
if (publicStops.length) {
|
||||
const pisCode = await pis.findByTiplocArray(publicStops);
|
||||
services[0].pis = pisCode[0]?.code;
|
||||
} else if ( services[0]?.operator === 'GW' && !publicStops.length) {
|
||||
services[0].pis = '0015';
|
||||
}
|
||||
}
|
||||
return services[0];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user