service.py

changeset 93
53ee9e945673
parent 92
16a5c37e4e67
child 94
e27c18f080d1
--- a/service.py	Tue Apr 24 23:21:34 2018 +0300
+++ b/service.py	Thu Apr 26 16:12:23 2018 +0300
@@ -214,6 +214,7 @@
 		cluster = bus_stop.cluster.url_name if len(bus_stop.cluster.stops) > 1 else None,
 		tr = tr,
 		typename = bus_stop.typename,
+		service = min(bus_stop.services),
 	)
 
 def week_schedule(bus_stop, **kwargs):
@@ -608,6 +609,7 @@
 		stops_in_cluster = stops_in_cluster,
 		amount_of_stops_in_cluster = len(stops_in_cluster),
 		tr = tr,
+		service = min(set.union(*[bus_stop.services for bus_stop in cluster.stops])),
 	)
 
 def day_class(weekday):
@@ -758,6 +760,7 @@
 		night = is_night_time(datetime.combine(today(), time()) + trip.schedule[-1].arrival_time),
 		tr = tr,
 		length = trip.length / 1000,
+		service = trip.route.service,
 	)
 
 @app.route('/route/<name>')
@@ -816,7 +819,7 @@
 	tr.load_regions(regions)
 	import busroute
 	busroute.regions = regions
-buses.load_buses(args.gtfs_zip_path, regions = regions)
+buses.load_buses(args.gtfs_zip_path)
 
 if __name__ == '__main__':
 	app.run(debug = args.debug, port = args.port)

mercurial