9737: Fix house number concatenation

This commit is contained in:
Nick Hall 2016-12-09 18:57:06 +00:00
parent aedf26b871
commit 9860fdb941

View File

@ -65,13 +65,18 @@ class PlaceDisplay(object):
else:
places = places[index:]
names = [item[0] for item in places]
if config.get('preferences.place-number'):
if len(places) > 1 and int(places[0][1]) == PlaceType.NUMBER:
names = names[1:]
names[0] = places[0][0] + ' ' + names[0]
types = [item[1] for item in places]
try:
idx = types.index(PlaceType.NUMBER)
except ValueError:
idx = None
if idx is not None and len(places) > idx+1:
combined = (places[idx][0] + ' ' + places[idx+1][0],
places[idx+1][1])
places = places[:idx] + [combined] + places[idx+2:]
names = [item[0] for item in places]
if config.get('preferences.place-reverse'):
names.reverse()