From 401b6a7bcf0e4f93f4605d77a35325b8211288ba Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Fri, 12 Dec 2025 10:36:45 +0100 Subject: fix: enhance route matching logic and improve CSS layout for consolidated circulation card --- .../Services/Providers/VitrasaTransitProvider.cs | 5 ++- .../Stops/ConsolidatedCirculationCard.css | 1 + .../Stops/ConsolidatedCirculationCard.tsx | 44 ++++++++++++---------- src/gtfs_perstop_report/src/street_name.py | 12 ++++-- 4 files changed, 37 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/Costasdev.Busurbano.Backend/Services/Providers/VitrasaTransitProvider.cs b/src/Costasdev.Busurbano.Backend/Services/Providers/VitrasaTransitProvider.cs index 7993b01..60703a0 100644 --- a/src/Costasdev.Busurbano.Backend/Services/Providers/VitrasaTransitProvider.cs +++ b/src/Costasdev.Busurbano.Backend/Services/Providers/VitrasaTransitProvider.cs @@ -104,7 +104,10 @@ public class VitrasaTransitProvider : ITransitProvider var scheduleRoute = NormalizeRouteName(c.Route); var scheduleTerminus = NormalizeRouteName(c.TerminusName); - return scheduleRoute == estimateRoute || scheduleTerminus == estimateRoute; + // TODO: Replace ñapa with fuzzy matching or better logic + Console.WriteLine($"Matching estimate route '{estimate.Route}' (normalized '{estimateRoute}') with schedule route '{c.Route}' (normalized '{scheduleRoute}') and terminus '{c.TerminusName}' (normalized '{scheduleTerminus}')"); + return scheduleRoute == estimateRoute || scheduleTerminus == estimateRoute || + scheduleRoute.Contains(estimateRoute) || estimateRoute.Contains(scheduleRoute); }) .OrderBy(c => c.CallingDateTime(nowLocal.Date)!.Value) .ToArray(); diff --git a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css index 935c06d..d9ed38f 100644 --- a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css +++ b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.css @@ -117,6 +117,7 @@ .consolidated-circulation-card .card-row.meta { justify-content: flex-start; + flex-wrap: wrap; gap: 0.4rem; } diff --git a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx index 425cf7b..679345f 100644 --- a/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx +++ b/src/frontend/app/components/Stops/ConsolidatedCirculationCard.tsx @@ -250,28 +250,32 @@ export const ConsolidatedCirculationCard: React.FC< }); } - if (estimate.currentPosition) { - if (estimate.isPreviousTrip) { - chips.push({ label: t("estimates.previous_trip"), kind: "gps" }); - } else { - chips.push({ label: t("estimates.bus_gps_position"), kind: "gps" }); + if (!reduced) { + if (estimate.currentPosition) { + if (estimate.isPreviousTrip) { + chips.push({ label: t("estimates.previous_trip"), kind: "gps" }); + } else { + chips.push({ label: t("estimates.bus_gps_position"), kind: "gps" }); + } } - } - - if (timeClass === "time-delayed") { - chips.push({ - label: reduced ? "!" : t("estimates.low_accuracy"), - tone: "warning", - kind: "warning", - }); - } - if (timeClass === "time-scheduled") { - chips.push({ - label: reduced ? "⧗" : t("estimates.no_realtime"), - tone: "warning", - kind: "warning", - }); + if (driver !== "renfe") { + if (timeClass === "time-delayed") { + chips.push({ + label: reduced ? "!" : t("estimates.low_accuracy"), + tone: "warning", + kind: "warning", + }); + } + + if (timeClass === "time-scheduled") { + chips.push({ + label: reduced ? "⧗" : t("estimates.no_realtime"), + tone: "warning", + kind: "warning", + }); + } + } } return chips; diff --git a/src/gtfs_perstop_report/src/street_name.py b/src/gtfs_perstop_report/src/street_name.py index 81d419b..e744ea3 100644 --- a/src/gtfs_perstop_report/src/street_name.py +++ b/src/gtfs_perstop_report/src/street_name.py @@ -14,10 +14,14 @@ NAME_REPLACEMENTS = { "FORA DE SERVIZO.G.B.": "", "Praza de Fernando O Católico": "", "Rúa da Travesía de Vigo": "Travesía de Vigo", - " de ": " ", - " do ": " ", - " da ": " ", - " das ": " ", + "Rúa de ": " ", + "Rúa do ": " ", + "Rúa da ": " ", + "Rúa das ": " ", + "Avda. de ": " ", + "Avda. do ": " ", + "Avda. da ": " ", + "Avda. das ": " ", "Riós": "Ríos", } -- cgit v1.3