From c3db1a9a85745597c1bec334443d630f009e30c8 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Fri, 6 Mar 2026 23:23:36 +0100 Subject: Clean cruft, add colour to football routes --- src/Enmarcha.Backend/Program.cs | 1 - .../Services/LineFormatterService.cs | 53 ---------------------- src/Enmarcha.Backend/Services/OtpService.cs | 21 +-------- .../Services/Processors/FeedConfigProcessor.cs | 2 + 4 files changed, 3 insertions(+), 74 deletions(-) delete mode 100644 src/Enmarcha.Backend/Services/LineFormatterService.cs (limited to 'src') 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(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); -builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped(); 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 _logger; private readonly FareService _fareService; - private readonly LineFormatterService _lineFormatter; private readonly FeedService _feedService; - public OtpService(HttpClient httpClient, IOptions config, IMemoryCache cache, ILogger logger, FareService fareService, LineFormatterService lineFormatter, FeedService feedService) + public OtpService(HttpClient httpClient, IOptions config, IMemoryCache cache, ILogger 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; } } -- cgit v1.3