mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
parseCommon: parse hints before locations
This commit is contained in:
parent
8fd72ca6f5
commit
d98910a651
1 changed files with 13 additions and 12 deletions
|
@ -49,6 +49,19 @@ const parseCommonData = (_ctx) => {
|
||||||
// **.arr.aProdX: arrivalLine -> common.lines[idx]
|
// **.arr.aProdX: arrivalLine -> common.lines[idx]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.hints = []
|
||||||
|
if (Array.isArray(c.remL)) {
|
||||||
|
common.hints = c.remL.map(hint => profile.parseHint(ctx, hint))
|
||||||
|
matches['**.remX'].forEach(([idx, parents]) => {
|
||||||
|
if ('number' === typeof idx) parents[0].hint = common.hints[idx]
|
||||||
|
})
|
||||||
|
matches['**.rRefL'].forEach(([idxs, parents]) => {
|
||||||
|
parents[0].hints = idxs
|
||||||
|
.filter(idx => !!common.hints[idx])
|
||||||
|
.map(idx => common.hints[idx])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
common.locations = []
|
common.locations = []
|
||||||
if (Array.isArray(c.locL)) {
|
if (Array.isArray(c.locL)) {
|
||||||
common.locations = c.locL.map(loc => profile.parseLocation(ctx, loc))
|
common.locations = c.locL.map(loc => profile.parseLocation(ctx, loc))
|
||||||
|
@ -80,18 +93,6 @@ const parseCommonData = (_ctx) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
common.hints = []
|
|
||||||
if (Array.isArray(c.remL)) {
|
|
||||||
common.hints = c.remL.map(hint => profile.parseHint(ctx, hint))
|
|
||||||
matches['**.remX'].forEach(([idx, parents]) => {
|
|
||||||
if ('number' === typeof idx) parents[0].hint = common.hints[idx]
|
|
||||||
})
|
|
||||||
matches['**.rRefL'].forEach(([idxs, parents]) => {
|
|
||||||
parents[0].hints = idxs
|
|
||||||
.filter(idx => !!common.hints[idx])
|
|
||||||
.map(idx => common.hints[idx])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
common.warnings = []
|
common.warnings = []
|
||||||
if (Array.isArray(c.himL)) {
|
if (Array.isArray(c.himL)) {
|
||||||
common.warnings = c.himL.map(w => profile.parseWarning(ctx, w))
|
common.warnings = c.himL.map(w => profile.parseWarning(ctx, w))
|
||||||
|
|
Loading…
Add table
Reference in a new issue