journey legs: parse cycle

This commit is contained in:
Jannis R 2018-04-29 14:29:29 +02:00
parent 3c052e9fef
commit 5d10d76a15
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -56,7 +56,15 @@ const createParseJourneyLeg = (profile, stations, lines, remarks) => {
for (let remark of pt.jny.remL) applyRemark(j, remark)
}
if (pt.jny.freq && pt.jny.freq.jnyL) {
const freq = pt.jny.freq || {}
if (freq.minC && freq.maxC) {
// todo: what is freq.numC?
res.cycle = {
min: freq.minC * 60,
max: freq.maxC * 60
}
}
if (freq.jnyL) {
const parseAlternative = (a) => {
const t = a.stopL[0].dTimeR || a.stopL[0].dTimeS
const when = profile.parseDateTime(profile, j.date, t)
@ -66,8 +74,7 @@ const createParseJourneyLeg = (profile, stations, lines, remarks) => {
when: when.toISO()
}
}
res.alternatives = pt.jny.freq.jnyL
.map(parseAlternative)
res.alternatives = freq.jnyL.map(parseAlternative)
}
}