From e7ecae629572c7f88fcae43c3b4b74ea5e9e1d16 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 4 Feb 2026 20:18:14 +0000 Subject: [PATCH] cope with zero lat long --- core/views/editor_helpers.py | 12 +++++++++--- parsers/people.py | 8 +------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/views/editor_helpers.py b/core/views/editor_helpers.py index d494cfd..fe977a9 100644 --- a/core/views/editor_helpers.py +++ b/core/views/editor_helpers.py @@ -148,12 +148,15 @@ def extract_gps(dict): def extract(gpsifd): if item:=is_present(gpsifd): # walrus n, d = item - return n/d + if d: + return n/d return None def rational(tup): nom, denom = tup - return nom/denom + if denom: + return nom/denom + return None def rationalise(item): df, mf, sf = item @@ -195,7 +198,10 @@ def extract_gps(dict): if item := is_present("GPSTimeStamp"): h, m, s = rationalise(item) - timestamp_utc = f"{ds} {h:02.0f}:{m:02.0f}:{s:02.0f} +00:00 UTC" + if h and m and s: + timestamp_utc = f"{ds} {h:02.0f}:{m:02.0f}:{s:02.0f} +00:00 UTC" + else: + timestamp_utc = f"{ds}" else: timestamp_utc = f"{ds}" diff --git a/parsers/people.py b/parsers/people.py index ed80635..afb6de2 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -229,16 +229,10 @@ def load_people_expos(): pe_list.append(PersonExpedition(person=p, expedition=expedition, noncaver=noncaver)) PersonExpedition.objects.bulk_create(pe_list) + this_year = current_expo() # side effect of calling current_expo is to create it if needed. ensure_users_are_persons() most_recent = Expedition.objects.all().first() print(most_recent) - expedition = most_recent - # STOP THIS, read how it works first before re-writing it ! - if most_recent != current_expo(): - print(f"{most_recent} != {current_expo()} so we need to create this year's expo") - expo_now = Expedition(year=current_expo()) - # expo_now.save() - expedition = expo_now check_new_signups(expedition) # pr.disable() # with open("folk_reader.prof", "w") as f: