mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
put leg-wide remarks into leg, not stopovers
[ci skip]
This commit is contained in:
parent
d44ec05a1d
commit
b5b2cfb38f
1 changed files with 15 additions and 10 deletions
|
@ -17,19 +17,24 @@ const applyRemarks = (leg, hints, warnings, refs) => {
|
|||
const toI = leg.stopovers.findIndex(s => s[locX] === ref.tLocX)
|
||||
if (fromI < 0 || toI < 0) continue
|
||||
|
||||
for (let i = fromI; i <= toI; i++) {
|
||||
const stopover = leg.stopovers[i]
|
||||
if (!stopover) continue
|
||||
if (Array.isArray(stopover.remarks)) {
|
||||
stopover.remarks.push(remark)
|
||||
} else {
|
||||
stopover.remarks = [remark]
|
||||
const wholeLeg = fromI === 0 && toI === (leg.stopovers.length - 1)
|
||||
if (!wholeLeg) {
|
||||
for (let i = fromI; i <= toI; i++) {
|
||||
const stopover = leg.stopovers[i]
|
||||
if (!stopover) continue
|
||||
if (Array.isArray(stopover.remarks)) {
|
||||
stopover.remarks.push(remark)
|
||||
} else {
|
||||
stopover.remarks = [remark]
|
||||
}
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(leg.remarks)) leg.remarks.push(remark)
|
||||
else leg.remarks = [remark]
|
||||
}
|
||||
|
||||
if (Array.isArray(leg.remarks)) leg.remarks.push(remark)
|
||||
else leg.remarks = [remark]
|
||||
// todo: `ref.tagL`
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue