Yhdistetty pysäkki.png ja iso-pysäkki.png

Wed, 28 Jun 2017 13:11:37 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 28 Jun 2017 13:11:37 +0300
changeset 32
ca1a0ea81cf6
parent 31
60045b362d71
child 33
f448f291c1dd

Yhdistetty pysäkki.png ja iso-pysäkki.png

compute-regions.py file | annotate | diff | comparison | revisions
static/iso-pysäkki.png file | annotate | diff | comparison | revisions
static/pysäkki.png file | annotate | diff | comparison | revisions
templates/cluster.html file | annotate | diff | comparison | revisions
templates/route.html file | annotate | diff | comparison | revisions
templates/stop.html file | annotate | diff | comparison | revisions
templates/trip.html file | annotate | diff | comparison | revisions
--- 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)
Binary file static/iso-pysäkki.png has changed
Binary file static/pysäkki.png has changed
--- 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 @@
 	<link rel="icon" type="image/png" href="/static/favicon.png" />
 	<link rel="stylesheet" type="text/css" href="/static/style.css" />
 	<meta charset='UTF-8' />
+	<meta http-equiv='refresh' content='60'>
 	<title>{{name}}</title>
 	{% if amount_of_stops_in_cluster >= 5 %}
 	<style>
@@ -35,11 +36,10 @@
 	</style>
 </head>
 <body>
-	<h1><img src="/static/iso-pysäkki.png" height="96" /> <span>{{name}}</span></h1>
+	<h1><img src="/static/pysäkki.png" height="96" /> <span>{{name}}</span></h1>
 	<p id="pysäkki-info">
-	<a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌 ({{location}})</a>
+		<a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌 ({{location}})</a>
 	</p>
-	<p>{{tr('stops-in-cluster', 'misc-text')}}:</p>
 	<div class="stops-in-cluster">
 	<ul>
 	{% for stop in stops_in_cluster %}
--- a/templates/route.html	Wed Jun 28 12:20:05 2017 +0300
+++ b/templates/route.html	Wed Jun 28 13:11:37 2017 +0300
@@ -4,6 +4,7 @@
 	<link rel="stylesheet" type="text/css" href="/static/style.css" />
 	<meta charset='UTF-8' />
 	<title>{{name}}</title>
+	<meta http-equiv='refresh' content='60'>
 </head>
 <body>
 	<h1><span>{{name}}</span></h1>
--- a/templates/stop.html	Wed Jun 28 12:20:05 2017 +0300
+++ b/templates/stop.html	Wed Jun 28 13:11:37 2017 +0300
@@ -4,6 +4,7 @@
 	<link rel="stylesheet" type="text/css" href="/static/style.css" />
 	<meta charset='UTF-8' />
 	<title>{{nimi}}</title>
+	<meta http-equiv='refresh' content='60'>
 	<style>
 	.sarake-määränpää
 	{
@@ -21,7 +22,7 @@
 	{% endif %}
 </head>
 <body>
-	<h1><img src="/static/iso-pysäkki.png" height="96" /> <span>{{name}}</span></h1>
+	<h1><img src="/static/pysäkki.png" height="96" /> <span>{{name}}</span></h1>
 	<p id="pysäkki-info">
 	{{region or ""}}
--- a/templates/trip.html	Wed Jun 28 12:20:05 2017 +0300
+++ b/templates/trip.html	Wed Jun 28 13:11:37 2017 +0300
@@ -3,6 +3,7 @@
 	<link rel="icon" type="image/png" href="/static/favicon.png" />
 	<link rel="stylesheet" type="text/css" href="/static/style.css" />
 	<meta charset='UTF-8' />
+	<meta http-equiv='refresh' content='60'>
 	<style>
 	.sarake-alue
 	{

mercurial