From 59d5934097ee25eac0b64a79acb58010d894e2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Tue, 16 Dec 2025 20:33:55 +0800 Subject: [PATCH] Print special route if only special route matches --- datasources/mtr/bus/query.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/datasources/mtr/bus/query.go b/datasources/mtr/bus/query.go index 3e9ed04..5ce3e42 100644 --- a/datasources/mtr/bus/query.go +++ b/datasources/mtr/bus/query.go @@ -1,7 +1,6 @@ package bus import ( - "log" "strings" query "github.com/tgckpg/golifehk/query" @@ -39,21 +38,24 @@ func Query(lang string, message string) query.IQueryResult { } matches := map[*BusStop]*BusStopBuses{} + sMatches := map[*BusStop]*BusStopBuses{} for _, entry := range *qBusStops.Results { busStop := any(entry).(*BusStop) for _, busStopSch := range schedules.BusStops { if busStopSch.BusStopId == busStop.StationId { if busStop.RouteId != busStop.ReferenceId { - // There were no indicator for special routes from getSchedule API - log.Printf("Ignoring special route matches: %s", busStop.ReferenceId) + sMatches[busStop] = &busStopSch continue } matches[busStop] = &busStopSch break } } + } + if len(matches) == 0 && 0 < len(sMatches) { + matches = sMatches } qr.Schedules = &matches