From ee21c9699f8352489ca14d6f1bfb6ebec98b06b7 Mon Sep 17 00:00:00 2001 From: MartinMikita Date: Thu, 22 Sep 2016 23:57:39 +0200 Subject: [PATCH] Fixed duplicates of name suffix and print if different names. #33 --- web/websearch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/websearch.py b/web/websearch.py index e6ae4c2..448eda8 100755 --- a/web/websearch.py +++ b/web/websearch.py @@ -428,7 +428,7 @@ def prepareNameSuffix(results): # Separate different country codes for row in results: - for field in ['country_code', 'state', 'city']: + for field in counts.keys(): if row[field] in counts[field]: continue # Skip states for not-US @@ -443,7 +443,7 @@ def prepareNameSuffix(results): if not row['city']: row = parseDisplayName(row) - if row['type'] != 'city' and len(row['city']) > 0 \ + if row['type'] != 'city' and len(row['city']) > 0 and row['name'] != row['city'] \ and (len(counts['city']) > 1 or len(counts['name']) > 1): name_suffix.append(row['city']) if row['country_code'] == 'us' and len(counts['state']) > 1 and len(row['state']) > 0: