service.py

changeset 99
0726eb9bc9d1
parent 98
c07a77c8a070
child 100
9b5e6b5e5e0b
--- a/service.py	Fri May 04 21:32:16 2018 +0300
+++ b/service.py	Fri May 04 21:43:46 2018 +0300
@@ -369,18 +369,20 @@
 				break
 		return length or len(route)
 	from math import inf
+	def route_limit(route):
+		return (route in night_routes) and 20 else 6
 	def route_key(route):
 		from math import log
 		return (
 			route in night_routes,
-			counts_per_variant.get(route, 0) < 20,
+			counts_per_variant.get(route, 0) < route_limit(route),
 			route_len(route),
 			str(route)
 		)
 	def routes_key(routes):
 		return min(route_key(route) for route in routes)
 	result = []
-	rare_variants = {variant['name'] for variant in all_variants if variant['count'] < 20}
+	rare_variants = {variant['name'] for variant in all_variants if variant['count'] < route_limit(route)}
 	rare_variant_groups = set()
 	for regions, routes in sorted(
 		routes_per_destination.items(),

mercurial