MTR: Sort schedules by route

This commit is contained in:
2022-11-15 00:22:39 +08:00
parent a062e37a4c
commit 55d4ac4adc
2 changed files with 25 additions and 1 deletions

View File

@@ -115,7 +115,18 @@ func ( this QueryResult ) Message() ( string, error ) {
}
} else {
if 0 < len( *this.Schedules ) {
for busStop, buses := range *this.Schedules {
busStops := [] *BusStop{}
for b, _ := range *this.Schedules {
busStops = append( busStops, b )
}
sort.Sort( ByRoute( busStops ) )
for _, busStop := range busStops {
buses := (*this.Schedules)[ busStop ]
writeShortRoute( &this.Lang, &sb, busStop )
for _, bus := range buses.Buses {
sb.WriteString( " \\* " )