diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2026-04-16 22:08:45 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2026-04-16 22:08:45 +0200 |
| commit | 3ae8d5c7111191957a8035887f79bf49f485c805 (patch) | |
| tree | 45d5798f6e6409b4d968bb4ecb093843c649ee03 /src/Enmarcha.Backend/Controllers/TileController.cs | |
| parent | fc6d4cbaf78f75a5ac234862ecbf86faeb78a338 (diff) | |
Diffstat (limited to 'src/Enmarcha.Backend/Controllers/TileController.cs')
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/TileController.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Enmarcha.Backend/Controllers/TileController.cs b/src/Enmarcha.Backend/Controllers/TileController.cs index 0d96a14..896fdb9 100644 --- a/src/Enmarcha.Backend/Controllers/TileController.cs +++ b/src/Enmarcha.Backend/Controllers/TileController.cs @@ -98,6 +98,7 @@ public class TileController : ControllerBase var stopsLayer = new Layer { Name = "stops" }; var features = new List<Feature>(); + var xuntaSeenBaseCodes = new HashSet<string>(StringComparer.OrdinalIgnoreCase); responseBody.Data?.StopsByBbox?.ForEach(stop => { @@ -110,6 +111,17 @@ public class TileController : ControllerBase return; } + // For xunta stops, deduplicate by stripping the first 2 chars of the code + // (e.g. "1007958" and "2007958" refer to the same physical stop) + if (feedId == "xunta" && codeWithinFeed.Length > 2) + { + var baseCode = codeWithinFeed[2..]; + if (!xuntaSeenBaseCodes.Add(baseCode)) + { + return; + } + } + // TODO: Duplicate from ArrivalsController var (Color, TextColor) = _feedService.GetFallbackColourForFeed(idParts[0]); var distinctRoutes = GetDistinctRoutes(feedId, stop.Routes ?? []); @@ -127,7 +139,9 @@ public class TileController : ControllerBase { "code", $"{idParts[0]}:{codeWithinFeed}" }, { "name", FeedService.NormalizeStopName(feedId, stop.Name) }, { "icon", GetIconNameForFeed(feedId) }, - { "transitKind", TransitKindClassifier.StringByFeed(feedId) } + { "transitKind", TransitKindClassifier.StringByFeed(feedId) }, + { "color", Color }, + { "textColor", TextColor } } }; |
