~phroa/boat-map

661a28b5573195f0a7e0b10ee9dec3a64983184d — Jack Stratton 6 months ago afe4f60
Account for 7-day schedules
1 files changed, 7 insertions(+), 3 deletions(-)

M make-map.py
M make-map.py => make-map.py +7 -3
@@ 159,9 159,13 @@ def draw_schedule():
        if (current_time.tm_hour + 1) * 60 + current_time.tm_min < max(times):
            schedule_lines[current_label].append('{}  {:6} {:6} {:6} {:6} {:6}'.format(*line))

    mf_or_satsun = 'Saturday and Sunday' if time.localtime().tm_wday > 4 else 'Monday through Friday'
    left_col = f'Leave Westbound ({mf_or_satsun})'
    right_col = f'Leave Eastbound ({mf_or_satsun})'
    if 'Daily' in ''.join(schedule_lines.keys()):
        left_col = 'Leave Westbound (Daily)'
        right_col = 'Leave Eastbound (Daily)'
    else:
        mf_or_satsun = 'Saturday and Sunday' if time.localtime().tm_wday > 4 else 'Monday through Friday'
        left_col = f'Leave Westbound ({mf_or_satsun})'
        right_col = f'Leave Eastbound ({mf_or_satsun})'

    left_lines = '   Anac.  Lopez  Shaw   Orcas  Friday\n' + '\n'.join(schedule_lines[left_col])
    right_lines = '   Friday Orcas  Shaw   Lopez  Anac.\n' + '\n'.join(schedule_lines[right_col])