busroute.py

changeset 55
0f1d046b3f78
parent 53
1c934953c3e6
child 56
e055b418fbf3
--- a/busroute.py	Thu Aug 31 21:30:34 2017 +0300
+++ b/busroute.py	Sun Sep 03 14:10:38 2017 +0300
@@ -15,6 +15,8 @@
 	'kemiö': 'kemiönsaari',
 	'kasnäs': 'kemiönsaari',
 	'pernon telakka': 'perno',
+	'paimion sairaala': 'paimio',
+	'hanhijoki': 'paimio',
 }
 
 # nimiä joista voidaan joustaa tarvittaessa
@@ -128,6 +130,8 @@
 		'merimasku': 50,
 		'turkuhalli': 100,
 		'messukeskus': 100,
+		'naantalin pikatie': 150,
+		'helsingin valtatie': 500,
 	}
 
 	if 'kauppatori' not in reitti:
@@ -176,10 +180,11 @@
 	# muodostetaan sign..
 	sign = [paino[0] for paino in weights]
 	to_place = sign[-1]
+	nearby_municipalities = {'Turku', 'Raisio', 'Naantali', 'Kaarina', 'Lieto'}
 	if from_place != to_place:
 		municipality_from = municipalities_per_region.get(from_place)
 		municipality_to = municipalities_per_region.get(to_place)
-		if municipality_from and municipality_to and municipality_from not in ['Turku', municipality_to]:
+		if municipality_from and municipality_to and municipality_from not in nearby_municipalities | {municipality_to} and municipality_to not in nearby_municipalities:
 			def convert_region(region):
 				municipality = municipalities_per_region.get(region, region)
 				if municipality != municipality_from:

mercurial