diff --git a/parse/remarks.js b/parse/remarks.js index 022dedc9..08c56a2b 100644 --- a/parse/remarks.js +++ b/parse/remarks.js @@ -45,8 +45,10 @@ const parseRemarks = (ctx, ref) => { if (remark.modDateTime || remark.letzteAktualisierung) { res.modified = ctx.profile.parseDateTime(ctx, null, remark.modDateTime || remark.letzteAktualisierung); } + if (remark.priority) { + res.priority = remark.priority; + } // TODO fromStops, toStops = routeIdxFrom ?? - // TODO prio return res; }) .filter(remark => remark.code != 'BEF' && remark.code != 'OP'); diff --git a/test/fixtures/dbnav-refresh-journey.js b/test/fixtures/dbnav-refresh-journey.js index 646bee94..14061a6c 100644 --- a/test/fixtures/dbnav-refresh-journey.js +++ b/test/fixtures/dbnav-refresh-journey.js @@ -194,6 +194,7 @@ const dbNavJourney = { summary: 'Einstieg mit Rollstuhl stufenfrei', text: 'Einstieg mit Rollstuhl stufenfrei', type: 'hint', + priority: 560, }, { text: 'Intercity 2: visit www.bahn.de/ic2 for more information', diff --git a/test/fixtures/dbnav-trip.js b/test/fixtures/dbnav-trip.js index e2b205e9..15cddcc5 100644 --- a/test/fixtures/dbnav-trip.js +++ b/test/fixtures/dbnav-trip.js @@ -80,6 +80,7 @@ const dbTrip = { summary: 'As ag 84100 heading towards Nürnberg Hbf from here', text: 'As ag 84100 heading towards Nürnberg Hbf from here', type: 'hint', + priority: 100, }, ], }, @@ -373,6 +374,7 @@ const dbTrip = { summary: 'As ag 63070 heading towards Nürnberg Hbf from here', text: 'As ag 63070 heading towards Nürnberg Hbf from here', type: 'hint', + priority: 100, }, ], }, @@ -487,6 +489,7 @@ const dbTrip = { summary: 'vertraglicher Beförderer DB Regio (München Flughafen Terminal - Regensburg Hbf)', text: 'vertraglicher Beförderer DB Regio (München Flughafen Terminal - Regensburg Hbf)', type: 'hint', + priority: 150, }, { text: 'Number of bicycles conveyed limited', @@ -499,6 +502,7 @@ const dbTrip = { summary: 'Behindertengerechte Ausstattung', text: 'Behindertengerechte Ausstattung', type: 'hint', + priority: 560, }, { text: 'power sockets for laptop', diff --git a/test/parse/remarks.js b/test/parse/remarks.js index 5002a95d..accb0806 100644 --- a/test/parse/remarks.js +++ b/test/parse/remarks.js @@ -216,6 +216,25 @@ tap.test('parses dbnav attributes correctly', (t) => { summary: 'Komfort Check-in possible (visit bahn.de/kci for more information)', text: 'Komfort Check-in possible (visit bahn.de/kci for more information)', type: 'hint', + priority: 200, + }, + ]; + + t.same(parse(ctx, input), expected); + t.end(); +}); + +tap.test('parses dbnav ruf attributes correctly', (t) => { + const input = { + attributNotizen: [{text: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)', key: 'cB', priority: 1}], + }; + const expected = [ + { + code: 'cB', + summary: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)', + text: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)', + type: 'warning', + priority: 1, }, ];