diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-06 23:23:36 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-06 23:23:36 +0100 |
| commit | c3db1a9a85745597c1bec334443d630f009e30c8 (patch) | |
| tree | a146bde390c518517fbabd527bb8bddf4160ec8b | |
| parent | 49ef6f4af837d4f3f4f367fa831f1ff176036c27 (diff) | |
Clean cruft, add colour to football routes
| -rw-r--r-- | src/Enmarcha.Backend/Program.cs | 1 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/LineFormatterService.cs | 53 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/OtpService.cs | 21 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/Processors/FeedConfigProcessor.cs | 2 |
4 files changed, 3 insertions, 74 deletions
diff --git a/src/Enmarcha.Backend/Program.cs b/src/Enmarcha.Backend/Program.cs index 025a0b3..e8a7968 100644 --- a/src/Enmarcha.Backend/Program.cs +++ b/src/Enmarcha.Backend/Program.cs @@ -123,7 +123,6 @@ builder.Services.AddSingleton<XuntaFareProvider>(); builder.Services.AddSingleton<ShapeTraversalService>(); builder.Services.AddSingleton<FeedService>(); builder.Services.AddSingleton<FareService>(); -builder.Services.AddSingleton<LineFormatterService>(); builder.Services.AddScoped<IArrivalsProcessor, VitrasaRealTimeProcessor>(); builder.Services.AddScoped<IArrivalsProcessor, CorunaRealTimeProcessor>(); diff --git a/src/Enmarcha.Backend/Services/LineFormatterService.cs b/src/Enmarcha.Backend/Services/LineFormatterService.cs deleted file mode 100644 index d3b6109..0000000 --- a/src/Enmarcha.Backend/Services/LineFormatterService.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Enmarcha.Backend.Types; - -namespace Enmarcha.Backend.Services; - -public class LineFormatterService -{ - public ConsolidatedCirculation Format(ConsolidatedCirculation circulation) - { - circulation.Route = circulation.Route.Replace("*", ""); - - if (circulation.Route == "FORA DE SERVIZO.G.B.") - { - circulation.Route = "García Barbón, 7 (fora de servizo)"; - return circulation; - } - - switch (circulation.Line) - { - case "A" when circulation.Route.StartsWith("\"1\""): - circulation.Line = "A1"; - circulation.Route = circulation.Route.Replace("\"1\"", ""); - return circulation; - case "6": - circulation.Route = circulation.Route - .Replace("\"", ""); - return circulation; - case "FUT": - { - if (circulation.Route == "CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO") - { - circulation.Line = "MAR"; - circulation.Route = "MARCADOR ⚽: CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO"; - } - - if (circulation.Route == "P. ESPAÑA-T.VIGO-S.BADÍA") - { - circulation.Line = "RIO"; - circulation.Route = "RÍO ⚽: P. ESPAÑA-T.VIGO-S.BADÍA"; - } - - if (circulation.Route == "NAVIA-BOUZAS-URZAIZ-G. ESPINO") - { - circulation.Line = "GOL"; - circulation.Route = "GOL ⚽: NAVIA-BOUZAS-URZAIZ-G. ESPINO"; - } - - return circulation; - } - default: - return circulation; - } - } -} diff --git a/src/Enmarcha.Backend/Services/OtpService.cs b/src/Enmarcha.Backend/Services/OtpService.cs index aadff77..e72877e 100644 --- a/src/Enmarcha.Backend/Services/OtpService.cs +++ b/src/Enmarcha.Backend/Services/OtpService.cs @@ -18,17 +18,15 @@ public class OtpService private readonly IMemoryCache _cache; private readonly ILogger<OtpService> _logger; private readonly FareService _fareService; - private readonly LineFormatterService _lineFormatter; private readonly FeedService _feedService; - public OtpService(HttpClient httpClient, IOptions<AppConfiguration> config, IMemoryCache cache, ILogger<OtpService> logger, FareService fareService, LineFormatterService lineFormatter, FeedService feedService) + public OtpService(HttpClient httpClient, IOptions<AppConfiguration> config, IMemoryCache cache, ILogger<OtpService> logger, FareService fareService, FeedService feedService) { _httpClient = httpClient; _config = config.Value; _cache = cache; _logger = logger; _fareService = fareService; - _lineFormatter = lineFormatter; _feedService = feedService; } @@ -334,23 +332,6 @@ public class OtpService case "6": headsign = headsign?.Replace("\"", ""); break; - case "FUT": - if (headsign == "CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO") - { - shortName = "MAR"; - headsign = "MARCADOR ⚽: CASTELAO-CAMELIAS-G.BARBÓN.M.GARRIDO"; - } - else if (headsign == "P. ESPAÑA-T.VIGO-S.BADÍA") - { - shortName = "RIO"; - headsign = "RÍO ⚽: P. ESPAÑA-T.VIGO-S.BADÍA"; - } - else if (headsign == "NAVIA-BOUZAS-URZAIZ-G. ESPINO") - { - shortName = "GOL"; - headsign = "GOL ⚽: NAVIA-BOUZAS-URZAIZ-G. ESPINO"; - } - break; } } diff --git a/src/Enmarcha.Backend/Services/Processors/FeedConfigProcessor.cs b/src/Enmarcha.Backend/Services/Processors/FeedConfigProcessor.cs index 562b8f1..7e5a745 100644 --- a/src/Enmarcha.Backend/Services/Processors/FeedConfigProcessor.cs +++ b/src/Enmarcha.Backend/Services/Processors/FeedConfigProcessor.cs @@ -92,6 +92,8 @@ public class FeedConfigProcessor : IArrivalsProcessor arrival.Route.ShortName = "GOL"; arrival.Headsign.Destination = "GOL ⚽: NAVIA-BOUZAS-URZAIZ-G. ESPINO"; } + arrival.Route.Colour = "6CACE4"; + arrival.Route.TextColour = "000000"; break; } } |
