Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
c3660d39
Commit
c3660d39
authored
Feb 17, 2022
by
Volker Krause
Browse files
Extract Amtrak station identifiers
parent
4cf1aea4
Pipeline
#139131
failed with stages
in 3 minutes and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/amtrack.js
View file @
c3660d39
...
...
@@ -29,6 +29,18 @@ function parseTicket(pdf, node, triggerNode) {
legs
.
push
(
leg
);
}
// station codes
const
codes
=
text
.
match
(
/
\n([
A-Z
]{3})
+
([
A-Z
]{3})
+
[^
]
.*
\n
/
);
if
(
legs
.
length
==
1
)
{
legs
[
0
].
reservationFor
.
departureStation
.
identifier
=
'
amtrak:
'
+
codes
[
1
];
legs
[
0
].
reservationFor
.
arrivalStation
.
identifier
=
'
amtrak:
'
+
codes
[
2
];
}
else
if
(
legs
.
length
==
2
&&
legs
[
0
].
reservationFor
.
departureStation
.
name
==
legs
[
1
].
reservationFor
.
arrivalStation
.
name
&&
legs
[
0
].
reservationFor
.
arrivalStation
.
name
==
legs
[
1
].
reservationFor
.
departureStation
.
name
)
{
legs
[
0
].
reservationFor
.
departureStation
.
identifier
=
'
amtrak:
'
+
codes
[
1
];
legs
[
0
].
reservationFor
.
arrivalStation
.
identifier
=
'
amtrak:
'
+
codes
[
2
];
legs
[
1
].
reservationFor
.
departureStation
.
identifier
=
'
amtrak:
'
+
codes
[
2
];
legs
[
1
].
reservationFor
.
arrivalStation
.
identifier
=
'
amtrak:
'
+
codes
[
1
];
}
var
reservations
=
new
Array
();
const
pasHdr
=
text
.
match
(
/PASSENGERS
\((\d
+
)\)
.*
\n
/
);
const
pasCount
=
pasHdr
[
1
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment