From 812cdf6be71ba80d0b762a293951cbb5e782c373 Mon Sep 17 00:00:00 2001 From: Aditya <205600203+Rohilalala@users.noreply.github.com> Date: Wed, 28 Oct 2026 15:09:27 +0530 Subject: [PATCH 1/2] =?UTF-8?q?fix(transit):=20show=20a=20reported=20359.6?= =?UTF-8?q?=C2=B0=20bearing=20as=20hdg=200=C2=B0,=20not=20hdg=20360=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The selected-vehicle card rounded the operator's reported bearing without wrapping, so a GTFS-Realtime vehicle heading 359.5° or more read "reported hdg 360°". The card now wraps after rounding: 359.6° reads "reported hdg 0°", 359.4° still reads "reported hdg 359°". --- docs/CURRENT-STATE.md | 4 +++- src/layers/transit/policy.js | 5 ++++- src/layers/transit/vocabulary.test.mjs | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index c55031a6a..4b9876428 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4347,7 +4347,9 @@ to 0.45 at two minutes, 0.20 at ten minutes and 0.08 at fifteen minutes. display delay and newest-report age, reported speed/stop, vehicle ID, and available trail duration. Report age is rounded to whole seconds and stays in seconds while that rounded count is below 90; otherwise it shows completed minutes calculated from the -rounded second count. Its anchor follows the rendered marker; text is +rounded second count. The reported heading wraps after rounding to whole +degrees, so a bearing of 359.5° or more reads `hdg 0°` rather than `hdg 360°`. +Its anchor follows the rendered marker; text is checked at 4 Hz and published when it changes. DETECT labels retain route, mode and motion, with the selected label suppressed beside its fuller card. Candidate membership changes on revisions, coalesced at 4 Hz; paints read diff --git a/src/layers/transit/policy.js b/src/layers/transit/policy.js index 5dc17daeb..33e03aab4 100644 --- a/src/layers/transit/policy.js +++ b/src/layers/transit/policy.js @@ -405,9 +405,12 @@ export function buildTransitSelectionCopy( reportedMotion.push( t('reported {speed} km/h', { speed: Math.round(record.speedMps * 3.6) }), ); + // 359.5° and above rounds to north; modulo keeps it from printing 360°. if (Number.isFinite(record.bearing)) reportedMotion.push( - t('reported hdg {heading}°', { heading: Math.round(record.bearing) }), + t('reported hdg {heading}°', { + heading: Math.round(record.bearing) % 360, + }), ); // The operator's own claim, kept as a REPORT rather than as the live state. // It describes the moment of the report, which the display may not have diff --git a/src/layers/transit/vocabulary.test.mjs b/src/layers/transit/vocabulary.test.mjs index d20910b74..89481efa3 100644 --- a/src/layers/transit/vocabulary.test.mjs +++ b/src/layers/transit/vocabulary.test.mjs @@ -43,6 +43,18 @@ test('the selection card calls a Toronto 501 a streetcar', () => { assert.doesNotMatch(copy.details.join(' | '), /Tram/); }); +test('the selection card reads a bearing that rounds to north as hdg 0°', () => { + const hdg = (bearing) => + buildTransitSelectionCopy( + ttc(), + { id: '4400', routeId: '501', timestamp: 0, bearing }, + 'tram', + 0, + ).details.find((line) => line.includes('hdg')); + assert.equal(hdg(359.4), 'reported hdg 359°'); + assert.equal(hdg(359.6), 'reported hdg 0°'); +}); + test('detection labels carry the operator vocabulary within the field width', () => { const klass = transitDetectionClass('tram', ttc()); assert.equal(klass, 'STREETCAR TTC'); From 197f24d8972b67ace59076748d37347c81559c13 Mon Sep 17 00:00:00 2001 From: Aditya <205600203+Rohilalala@users.noreply.github.com> Date: Wed, 28 Oct 2026 17:38:45 +0530 Subject: [PATCH 2/2] docs(changelog): add #1452 fragment --- changelog.d/1452-transit-heading-north.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1452-transit-heading-north.md diff --git a/changelog.d/1452-transit-heading-north.md b/changelog.d/1452-transit-heading-north.md new file mode 100644 index 000000000..95c81a080 --- /dev/null +++ b/changelog.d/1452-transit-heading-north.md @@ -0,0 +1,3 @@ +- Show a transit vehicle's reported bearing of 359.5° or more as 0°. The + selected-vehicle card rounded it without wrapping, so a bus heading 359.6° + read "reported hdg 360°" (Aditya, @Rohilalala, #1452).