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