Added kmb schedules

This commit is contained in:
2022-09-25 18:48:22 +08:00
parent b251e35be4
commit 41be1db381
8 changed files with 283 additions and 40 deletions

View File

@@ -37,8 +37,29 @@ func ( routeStop RouteStop ) NextStop() *RouteStop {
return nil
}
type ByRouteId []RouteStop
func ( this *RouteStop ) Reload() {
func (a ByRouteId) Len() int { return len(a) }
func (a ByRouteId) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByRouteId) Less(i, j int) bool { return a[i].RouteId < a[j].RouteId }
searchData := [] *string{}
busStop := *this.BusStop
searchData = append( searchData, &busStop.Name_en )
searchData = append( searchData, &busStop.Name_tc )
this.Key = &this.RouteId
this.SearchData = &searchData
}
type ByRoute [] *RouteStop
func (a ByRoute) Len() int { return len(a) }
func (a ByRoute) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByRoute) Less(i, j int) bool {
_a := *a[i]
_b := *a[j]
if _a.RouteId == _b.RouteId {
if _a.Direction == _b.Direction {
return _a.ServiceType < _b.ServiceType
}
return _a.Direction < _b.Direction
}
return _a.RouteId < _b.RouteId
}