63 def sign(schedule_entry): |
64 def sign(schedule_entry): |
64 from math import ceil |
65 from math import ceil |
65 trip_length = schedule_entry['trip'].length - schedule_entry['stop'].traveled_distance |
66 trip_length = schedule_entry['trip'].length - schedule_entry['stop'].traveled_distance |
66 sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length) |
67 sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length) |
67 if sign: |
68 if sign: |
68 sign = [tr(place, 'paikat') for place in sign] |
69 sign_representation = ' - '.join(tr(place, 'paikat') for place in sign if place not in suffix_regions) |
69 sign_representation = ' - '.join(sign) |
70 sign_representation += ''.join(' ' + tr(place, 'suffix-places') for place in sign if place in suffix_regions) |
70 #if len(sign_representation) > 25: |
71 #if len(sign_representation) > 25: |
71 # k = ceil(len(sign) / 2) |
72 # k = ceil(len(sign) / 2) |
72 # sign_representation = ' - '.join(sign[:k]) + '\n' + ' - '.join(sign[k:]) |
73 # sign_representation = ' - '.join(sign[:k]) + '\n' + ' - '.join(sign[k:]) |
73 return sign_representation |
74 return sign_representation |
74 else: |
75 else: |