# HG changeset patch # User Teemu Piippo # Date 1498644697 -10800 # Node ID ca1a0ea81cf664c301a39e0816848bc9cc384b90 # Parent 60045b362d71068d53537e180a40bf34a3366a46 Yhdistetty pysäkki.png ja iso-pysäkki.png diff -r 60045b362d71 -r ca1a0ea81cf6 compute-regions.py --- a/compute-regions.py Wed Jun 28 12:20:05 2017 +0300 +++ b/compute-regions.py Wed Jun 28 13:11:37 2017 +0300 @@ -32,20 +32,19 @@ bus_stop_districts = {} for name, stop_id in representatives.items(): - if stop_id is None: - continue - if stop_id not in bus_stops: - print('Representative %r for region %r not found in schedule' % (stop_id, name), file = sys.stderr) - else: - for district_shape in district_shapes: - if district_shape.sisältää_pisteen(bus_stops[stop_id]): - assert name not in districts - districts[name] = district_shape - district_shapes.remove(district_shape) - bus_stop_districts[stop_id] = name - break + if stop_id: + if stop_id not in bus_stops: + print('Representative %r for region %r not found in schedule' % (stop_id, name), file = sys.stderr) else: - print('Cannot find a shape for %r' % name, file = sys.stderr) + for district_shape in district_shapes: + if district_shape.sisältää_pisteen(bus_stops[stop_id]): + assert name not in districts + districts[name] = district_shape + district_shapes.remove(district_shape) + bus_stop_districts[stop_id] = name + break + else: + print('Cannot find a shape for %r' % name, file = sys.stderr) for stop_id, stop_position in bus_stops.items(): for district, shape in districts.items(): @@ -55,7 +54,7 @@ else: bus_stop_districts[stop_id] = None -covered = sum(int(bool(k)) for k in bus_stop_districts.values()) +covered = sum(1 if value else 0 for value in bus_stop_districts.values()) total = len(bus_stops) print('%.1f%% bus stops covered.' % (covered * 100 / total), file = sys.stderr) json.dump(bus_stop_districts, sys.stdout, indent = 2) diff -r 60045b362d71 -r ca1a0ea81cf6 static/iso-pysäkki.png Binary file static/iso-pysäkki.png has changed diff -r 60045b362d71 -r ca1a0ea81cf6 static/pysäkki.png Binary file static/pysäkki.png has changed diff -r 60045b362d71 -r ca1a0ea81cf6 templates/cluster.html --- a/templates/cluster.html Wed Jun 28 12:20:05 2017 +0300 +++ b/templates/cluster.html Wed Jun 28 13:11:37 2017 +0300 @@ -3,6 +3,7 @@ + {{name}} {% if amount_of_stops_in_cluster >= 5 %} -

{{name}}

+

{{name}}

- 📌 ({{location}}) + 📌 ({{location}})

-

{{tr('stops-in-cluster', 'misc-text')}}: