From 38340e01ff8bec3c1a89b9bd294c49f78a73e411 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 22 Jun 2019 22:07:29 +0000
Subject: [PATCH] Fix delay calcs when times are from two different days (i.e. 23:59-00:00)

---
 stops/index.php |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/stops/index.php b/stops/index.php
index 5795afa..eca9c39 100644
--- a/stops/index.php
+++ b/stops/index.php
@@ -48,20 +48,21 @@
 	
 	// Build a structure for the UI
 	$stop_list = [];
-	$query_lower = mb_strtolower($_GET['query'], 'UTF-8');
+	$query_lower = normalize_name_cmp($_GET['query']);
 	foreach($ids as $id) {
-		similar_text(
+		$letters = similar_text(
 			$query_lower,
-			mb_strtolower($stops[$id], 'UTF-8'),
+			normalize_name_cmp($stops[$id]),
 			$percent
 		);
+		$percent += $letters * 100;
 		// -5 due to UTF-8
 		if(substr($stops[$id], -5) == '(nż)' && !$find_ondemand) {
 			$percent /= 2;
 		}
 		$stop_list[] = [
 			'id' => $id,
-			'name' => $stops[$id],
+			'name' => normalize_name($stops[$id]),
 			'type' => 'stop',
 			'relevance' => $percent,
 		];

--
Gitblit v1.9.1