# HG changeset patch # User Teemu Piippo # Date 1520247402 -7200 # Node ID 62e753b7d3ffc10ed73da7592d06d4402e90ffdc # Parent 30cc6a1d1903ad3e8ef7b8ac66f9e9bf166a5c8b things diff -r 30cc6a1d1903 -r 62e753b7d3ff service.py --- a/service.py Mon Mar 05 12:47:40 2018 +0200 +++ b/service.py Mon Mar 05 12:56:42 2018 +0200 @@ -81,10 +81,10 @@ else: return schedule_entry['trip'].schedule[-1].stop.name -def long_form_sign(schedule_entry): +def long_form_sign(schedule_entry, long = True): from math import ceil trip_length = schedule_entry['trip'].length - schedule_entry['stop'].traveled_distance - sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length, long = True) + sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length, long = long) if sign: return { 'destination': tr(sign[-1], 'places'), @@ -274,6 +274,13 @@ 'abbreviation': trip_abbreviation(trip), }) +def current_bus_day(): + from datetime import date, datetime, timedelta + day = date.today() + if datetime.now().hour < 5: + day -= timedelta(1) + return day + @app.route('/stop_display/') def stop_display(reference): from buses import bus_stops @@ -282,12 +289,12 @@ bus_stop = bus_stops[reference] except KeyError: abort(404) - for i, schedule_entry in enumerate(bus_stop.schedule_for_day(today(), arrivals = False)): + for i, schedule_entry in enumerate(bus_stop.schedule_for_day(current_bus_day(), arrivals = False)): schedule.append({ 'time_data': schedule_entry['time'], 'time': time_representation(schedule_entry['time']), 'route': schedule_entry['trip'].route.reference, - 'sign': long_form_sign(schedule_entry), + 'sign': long_form_sign(schedule_entry, long = False), 'trip': schedule_entry['stop'].trip.name, 'night': is_night_time(schedule_entry['time']), 'imminent': imminent(schedule_entry), diff -r 30cc6a1d1903 -r 62e753b7d3ff templates/stop_display.html --- a/templates/stop_display.html Mon Mar 05 12:47:40 2018 +0200 +++ b/templates/stop_display.html Mon Mar 05 12:56:42 2018 +0200 @@ -19,17 +19,11 @@ .next-leave td { - height: 30vh; + height: 12vh; vertical-align: middle; } - .next-leave-list - { - width: 100%; - } - .next-leave-time, - .next-leave-places li.next-leave-destination, .next-leave-route { font-weight: bold; @@ -41,7 +35,7 @@ text-align: left; } - .next-leave-route + .next-leave-route .route-symbol { border: 0.5vmin solid black; border-radius: 100%; @@ -50,6 +44,11 @@ min-height: 12vmin; text-align: center; background: #ffd90f; + } + + .next-leave, .next-leave table + { + width: 100%; } .next-leave-places @@ -61,8 +60,9 @@ { list-style: none; font-size: 6vmin; - padding-top: 1vw; font-weight: normal; + float: left; + padding-left: 10pt; } #other-leaves @@ -89,6 +89,13 @@ text-align: center; } + .next-leave-destination + { + font-size: 7vh; + font-weight: bold; + text-align: left; + } + .other-leave-time { width: 30%; @@ -223,10 +230,7 @@

{{ref}} {{name}}

-
    {% for schedule_entry in schedule[:num_imminent_leaves] %} -
  • - - + + + + + + + + - - -
    @@ -236,24 +240,26 @@ {{schedule_entry['time']}}​ {% endif %} + + {{schedule_entry['route']}} +
    {{schedule_entry['sign']['destination']}}
      -
    • - {{schedule_entry['sign']['destination']}}
    • - {% for entry in schedule_entry['sign']['via'] %} -
    • {{entry}}
    • - {% endfor %} + {% for entry in schedule_entry['sign']['via'] %} +
    • {{entry}}
    • + {% endfor %}
    {{schedule_entry['route']}}
    - -
  • {% endfor %} -
{% if schedule[num_imminent_leaves] %}