service.py

changeset 63
20865458d936
parent 61
0c9b09f694f3
child 64
6dbda3b1015f
equal deleted inserted replaced
62:6cc9c3cc9183 63:20865458d936
96 'imminent': imminent(schedule_entry), 96 'imminent': imminent(schedule_entry),
97 }) 97 })
98 return render_template( 98 return render_template(
99 'stop.html', 99 'stop.html',
100 schedule = schedule, 100 schedule = schedule,
101 name = bus_stop.code + ' ' + tr(bus_stop.name, 'bus_stops'), 101 name = bus_stop.code + ' ' + tr(bus_stop.name, 'bus-stops'),
102 link_to_map = bus_stop.location.link_to_map, 102 link_to_map = bus_stop.location.link_to_map,
103 region = bus_stop.region, 103 region = bus_stop.region,
104 location = bus_stop.location, 104 location = bus_stop.location,
105 cluster = bus_stop.cluster.url_name if len(bus_stop.cluster.stops) > 1 else None, 105 cluster = bus_stop.cluster.url_name if len(bus_stop.cluster.stops) > 1 else None,
106 tr = tr, 106 tr = tr,
136 'sign': sign(schedule_entry), 136 'sign': sign(schedule_entry),
137 'trip': schedule_entry['stop'].trip.name, 137 'trip': schedule_entry['stop'].trip.name,
138 'night': is_night_time(schedule_entry['time']), 138 'night': is_night_time(schedule_entry['time']),
139 'stop_id': schedule_entry['stop'].stop.reference, 139 'stop_id': schedule_entry['stop'].stop.reference,
140 'stop_code': schedule_entry['stop'].stop.code, 140 'stop_code': schedule_entry['stop'].stop.code,
141 'stop_name': tr(schedule_entry['stop'].stop.name, 'pysäkit'), 141 'stop_name': tr(schedule_entry['stop'].stop.name, 'bus-stops'),
142 'imminent': imminent(schedule_entry), 142 'imminent': imminent(schedule_entry),
143 }) 143 })
144 stops_in_cluster = sorted( 144 stops_in_cluster = sorted(
145 ({ 145 ({
146 'id': stop.reference, 146 'id': stop.reference,
147 'code': stop.code, 147 'code': stop.code,
148 'name': tr(stop.name, 'pysäkit'), 148 'name': tr(stop.name, 'bus-stops'),
149 } for stop in cluster.stops), 149 } for stop in cluster.stops),
150 key = lambda stop: (len(stop['id']), stop['id']) 150 key = lambda stop: (len(stop['id']), stop['id'])
151 ) 151 )
152 return render_template( 152 return render_template(
153 'cluster.html', 153 'cluster.html',
154 schedule = schedule, 154 schedule = schedule,
155 name = tr(cluster.name, 'paikat', 'pysäkkiryhmät', 'pysäkit'), 155 name = tr(cluster.name, 'paikat', 'pysäkkiryhmät', 'bus-stops'),
156 link_to_map = cluster.center.link_to_map, 156 link_to_map = cluster.center.link_to_map,
157 location = cluster.center, 157 location = cluster.center,
158 stops_in_cluster = stops_in_cluster, 158 stops_in_cluster = stops_in_cluster,
159 amount_of_stops_in_cluster = len(stops_in_cluster), 159 amount_of_stops_in_cluster = len(stops_in_cluster),
160 tr = tr, 160 tr = tr,

mercurial