diff --git a/src/app/utils/transfer-render-handle.ts b/src/app/utils/transfer-render-handle.ts index c845094..b7935dd 100644 --- a/src/app/utils/transfer-render-handle.ts +++ b/src/app/utils/transfer-render-handle.ts @@ -1,8 +1,8 @@ import timeFormatter from './time-formatter'; import dateWithNotimeFormatter from './date-with-notime-formatter'; export class TransferRenderHandle { - public arsfFormatter(flight){ - if(flight['MVIN'] === 'A'){ + public arsfFormatter(flight) { + if (flight['MVIN'] === 'A') { if (Array.isArray(flight['MAFL']) && flight['MAFL'].length > 0) { let arsf = []; for (let i = 0; i < flight['MAFL'].length; i++) { @@ -15,12 +15,12 @@ export class TransferRenderHandle { } else { return ''; } - }else{ + } else { return ''; } } - public desfFormatter(flight){ - if(flight['MVIN'] === 'D'){ + public desfFormatter(flight) { + if (flight['MVIN'] === 'D') { if (Array.isArray(flight['MAFL']) && flight['MAFL'].length > 0) { let desf = []; for (let i = 0; i < flight['MAFL'].length; i++) { @@ -33,7 +33,7 @@ export class TransferRenderHandle { } else { return ''; } - }else{ + } else { return ''; } } @@ -392,9 +392,43 @@ export class TransferRenderHandle { } } public padtFormatter(flight) { - if (flight['PADT']) { - return timeFormatter(flight['PADT']); - } else { + if (flight['MVIN'] === 'A') { + if (flight['PADT']) { + if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) { + let lastRout = flight['ROUT'][flight['ROUT'].length - 1]; + if (lastRout['SCDT']){ + return timeFormatter(flight['PADT']) + '(' + timeFormatter(lastRout['SCDT']) + ')'; + }else{ + return timeFormatter(flight['PADT']); + } + } else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') { + if (flight['ROUT']['SCDT']){ + return timeFormatter(flight['PADT']) + '(' + timeFormatter(flight['ROUT']['SCDT']) + ')'; + }else{ + return timeFormatter(flight['PADT']); + } + }else{ + return timeFormatter(flight['PADT']); + } + } else { + if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) { + let lastRout = flight['ROUT'][flight['ROUT'].length - 1]; + if (lastRout['SCDT']){ + return '(' + timeFormatter(lastRout['SCDT']) + ')'; + }else{ + return ''; + } + } else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') { + if (flight['ROUT']['SCDT']){ + return '(' + timeFormatter(flight['ROUT']['SCDT']) + ')'; + }else{ + return ''; + } + }else{ + return ''; + } + } + }else{ return ''; } } diff --git a/src/app/utils/web-worker-handle.ts b/src/app/utils/web-worker-handle.ts index fb663ae..291f409 100644 --- a/src/app/utils/web-worker-handle.ts +++ b/src/app/utils/web-worker-handle.ts @@ -568,8 +568,42 @@ export default function (dynamicData?) { } }, 'PADT': function padtFormatter(flight) { - if (flight['PADT']) { - return timeFormatter(flight['PADT']); + if (flight['MVIN'] === 'A') { + if (flight['PADT']) { + if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) { + let lastRout = flight['ROUT'][flight['ROUT'].length - 1]; + if (lastRout['SCDT']) { + return timeFormatter(flight['PADT']) + '(' + timeFormatter(lastRout['SCDT']) + ')'; + } else { + return timeFormatter(flight['PADT']); + } + } else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') { + if (flight['ROUT']['SCDT']) { + return timeFormatter(flight['PADT']) + '(' + timeFormatter(flight['ROUT']['SCDT']) + ')'; + } else { + return timeFormatter(flight['PADT']); + } + } else { + return timeFormatter(flight['PADT']); + } + } else { + if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) { + let lastRout = flight['ROUT'][flight['ROUT'].length - 1]; + if (lastRout['SCDT']) { + return '(' + timeFormatter(lastRout['SCDT']) + ')'; + } else { + return ''; + } + } else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') { + if (flight['ROUT']['SCDT']) { + return '(' + timeFormatter(flight['ROUT']['SCDT']) + ')'; + } else { + return ''; + } + } else { + return ''; + } + } } else { return ''; } diff --git a/src/assets/web-worker-handle.js b/src/assets/web-worker-handle.js index bd7f791..d396be4 100644 --- a/src/assets/web-worker-handle.js +++ b/src/assets/web-worker-handle.js @@ -569,8 +569,42 @@ onmessage = function (dynamicData) { } }, 'PADT': function padtFormatter(flight) { - if (flight['PADT']) { - return timeFormatter(flight['PADT']); + if (flight['MVIN'] === 'A') { + if (flight['PADT']) { + if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) { + let lastRout = flight['ROUT'][flight['ROUT'].length - 1]; + if (lastRout['SCDT']) { + return timeFormatter(flight['PADT']) + '(' + timeFormatter(lastRout['SCDT']) + ')'; + } else { + return timeFormatter(flight['PADT']); + } + } else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') { + if (flight['ROUT']['SCDT']) { + return timeFormatter(flight['PADT']) + '(' + timeFormatter(flight['ROUT']['SCDT']) + ')'; + } else { + return timeFormatter(flight['PADT']); + } + } else { + return timeFormatter(flight['PADT']); + } + } else { + if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) { + let lastRout = flight['ROUT'][flight['ROUT'].length - 1]; + if (lastRout['SCDT']) { + return '(' + timeFormatter(lastRout['SCDT']) + ')'; + } else { + return ''; + } + } else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') { + if (flight['ROUT']['SCDT']) { + return '(' + timeFormatter(flight['ROUT']['SCDT']) + ')'; + } else { + return ''; + } + } else { + return ''; + } + } } else { return ''; }