aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.Backend/Services
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-11-30 19:17:02 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2025-11-30 19:17:02 +0100
commitcee521142a4e0673b155d97c3e4825b7fec1987f (patch)
treee8030687f62a63c34ad69cb81eefe8470c55cfee /src/Costasdev.Busurbano.Backend/Services
parente7283ba10d45b42e1274cd13c3d6aabec57c85b4 (diff)
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.
Diffstat (limited to 'src/Costasdev.Busurbano.Backend/Services')
-rw-r--r--src/Costasdev.Busurbano.Backend/Services/LineFormatterService.cs51
1 files changed, 51 insertions, 0 deletions
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;
+ }
+}