From 1d37f31a7e6363b3c0bf7206860845f20a0e3d58 Mon Sep 17 00:00:00 2001 From: Frank Adaemmer Date: Sun, 21 May 2023 14:58:14 +0200 Subject: [PATCH] reduce lines --- mappersons.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mappersons.py b/mappersons.py index a3eb7b4..854ee13 100644 --- a/mappersons.py +++ b/mappersons.py @@ -106,17 +106,23 @@ def generateWeek(week, persons, locations, output_path=Path('.')): img = create_circle(image_paths) img.save(output_path / Path(png_file)) bases = [] + base_names = [] popup = "

%s

" % cur_loc for cur_per, cur_info in cur_persons.items(): popup += "

%s

" % cur_per popup += "
".join(cur_info['tasks']) if cur_info['base'] != cur_loc: - l = [x for x in locations if x['name'] == cur_info['base']][0] - bases.append({ - "city": cur_info['base'], - "lat": l['lat'], - "lng": l['lng'], - }) + base_names.append(cur_info['base']) + + base_names = list(set(base_names)) + for base in base_names: + l = [x for x in locations if x['name'] == base][0] + + bases.append({ + "city": base, + "lat": l['lat'], + "lng": l['lng'], + }) l = [x for x in locations if x['name'] == cur_loc][0] week_json.append({ "city": cur_loc,