aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Controllers/TileController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Enmarcha.Backend/Controllers/TileController.cs')
-rw-r--r--src/Enmarcha.Backend/Controllers/TileController.cs16
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 }
}
};