Näytä myös aikataulut jotka ovat minuutti sitten menneet

Sun, 02 Jul 2017 16:14:56 +0300

author
teemu
date
Sun, 02 Jul 2017 16:14:56 +0300
changeset 42
0b53b7c70875
parent 41
4354d459c231
child 43
1c9102fea431

Näytä myös aikataulut jotka ovat minuutti sitten menneet

buses.py file | annotate | diff | comparison | revisions
service.py file | annotate | diff | comparison | revisions
--- a/buses.py	Wed Jun 28 17:52:42 2017 +0300
+++ b/buses.py	Sun Jul 02 16:14:56 2017 +0300
@@ -112,7 +112,7 @@
 				if stop and (arrivals or not stop.is_arrival) and stop is not trip.schedule[-1]:
 					# ja jos tämä halt on tulevaisuudessa,
 					stop_time = datetime.combine(date, time()) + stop.arrival_time
-					if stop_time >= now():
+					if stop_time + timedelta(minutes = 1) >= now():
 						# lisää halt listaan.
 						result.append({
 							'time': stop_time,
--- a/service.py	Wed Jun 28 17:52:42 2017 +0300
+++ b/service.py	Sun Jul 02 16:14:56 2017 +0300
@@ -107,7 +107,7 @@
 
 def time_representation(time, relative = True):
 	time_difference = time - now()
-	if relative and time_difference > timedelta(0) and time_difference < timedelta(minutes = 1):
+	if relative and timedelta(minutes = -1) < time_difference < timedelta(minutes = 1):
 		return tr('right-now', 'misc-text')
 	elif relative and time_difference > timedelta(0) and time_difference < timedelta(minutes = 10):
 		return '%dm' % round(time_difference.seconds / 60)

mercurial