From cee521142a4e0673b155d97c3e4825b7fec1987f Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Sun, 30 Nov 2025 19:17:02 +0100 Subject: Refactor street name processing and remove unused stop downloader script - Updated `street_name.py` to simplify street name handling by removing the `re_remove_street_type` regex and exception streets list, replacing them with a dictionary for name replacements. - Deleted the `download-stops.py` script from the Santiago stop downloader, which was no longer needed. - Removed the empty `.gitkeep` file from the overrides directory. - Added a new `VigoController` class to handle stop estimates and timetables, including error handling for missing data. - Introduced `LineFormatterService` to format circulation routes based on specific line conditions. --- .../Services/LineFormatterService.cs | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs (limited to 'src/Costasdev.Busurbano.Backend/Services') diff --git a/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs b/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs new file mode 100644 index 0000000..788634d --- /dev/null +++ b/src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs @@ -0,0 +1,51 @@ +using Costasdev.Busurbano.Backend.Types; + +namespace Costasdev.Busurbano.Backend.Services; + +public class LineFormatterService +{ + public static ConsolidatedCirculation Format(ConsolidatedCirculation circulation) + { + circulation.Route = circulation.Route.Replace("*", ""); + + if (circulation.Line == "18A") + { + circulation.Route = circulation.Route + .Replace("\"A\" ", "") + .Trim() + .Replace("SARDOMA por MANTELAS", "Praza de Miraflores"); + } + + if (circulation.Line == "5A") + { + circulation.Route = circulation.Route + .Replace("Rúa da Travesía de Vigo, 220", "URZAIZ - TVA DE VIGO"); + } + + if (circulation.Line == "5B") + { + circulation.Route = circulation.Route + .Replace("Rúa de Sanjurjo Badía, 252", "S. BADIA - TVA DE VIGO"); + } + + if (circulation.Line == "11") + { + circulation.Route = circulation.Route + .Replace("Avda. de Cesáreo Vázquez, 61", "SAN MIGUEL por FLORIDA"); + } + + if (circulation.Line == "4C") + { + circulation.Route = circulation.Route + .Replace("Rúa do Porriño (fronte 9)", "COIA POR CASTELAO"); + } + + if (circulation.Line == "6") + { + circulation.Route = circulation.Route + .Replace("\"", ""); + } + + return circulation; + } +} -- cgit v1.3