service.py

changeset 134
4ac0f2e2ec4e
parent 127
2bc0529d44a5
child 136
27324a81beca
--- a/service.py	Thu Dec 06 20:47:19 2018 +0200
+++ b/service.py	Thu Dec 06 23:39:20 2018 +0200
@@ -211,7 +211,7 @@
 			'trip': schedule_entry['stop'].trip.name,
 			'night': is_night_time(schedule_entry['time']),
 			'imminent': imminent(schedule_entry),
-			'id': str(schedule_entry['stop'].uuid),
+			'id': str(schedule_entry['stop'].primary_key),
 			'gone': schedule_entry['gone'],
 		})
 	return render_template(
@@ -449,7 +449,6 @@
 		'abbreviation': trip_abbreviation(trip),
 	})
 
-
 def service_start_time():
 	from datetime import date, datetime, timedelta
 	result = datetime.now().replace(hour = 0, minute = 0, second = 0, microsecond = 0)
@@ -457,20 +456,6 @@
 		result -= timedelta(1)
 	return result
 
-@app.route('/find_halt/<stop_reference>/<blockref>/<int:originalaimeddeparturetime>')
-def find_halt(stop_reference, blockref, originalaimeddeparturetime):
-	from datetime import datetime
-	from flask import jsonify
-	info = (blockref, datetime.fromtimestamp(originalaimeddeparturetime) - service_start_time())
-	trip = buses.trips_by_vehicle_info[info]
-	try:
-		return jsonify({
-			'id': [str(halt.uuid) for halt in buses.trips_by_vehicle_info[info].schedule if halt.stop.reference == stop_reference][0],
-		})
-	except:
-		abort(404)
-
-
 def current_bus_day():
 	from datetime import date, datetime, timedelta
 	day = date.today()

mercurial