mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(transit): show a reported 359.6° bearing as hdg 0°, not hdg 360°
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°".
This commit is contained in:
1 parent
a4d3701c3c
commit
812cdf6be7
3 files changed
+19
-2
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user