put leg-wide remarks into leg, not stopovers

[ci skip]
This commit is contained in:
Jannis R 2018-07-16 14:41:41 +02:00
parent d44ec05a1d
commit b5b2cfb38f
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -17,6 +17,8 @@ const applyRemarks = (leg, hints, warnings, refs) => {
const toI = leg.stopovers.findIndex(s => s[locX] === ref.tLocX)
if (fromI < 0 || toI < 0) continue
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
@ -26,10 +28,13 @@ const applyRemarks = (leg, hints, warnings, refs) => {
stopover.remarks = [remark]
}
}
} else {
continue
}
}
if (Array.isArray(leg.remarks)) leg.remarks.push(remark)
else leg.remarks = [remark]
}
// todo: `ref.tagL`
}
}