mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 03:07:48 +00:00
cope with zero lat long
This commit is contained in:
@@ -148,12 +148,15 @@ def extract_gps(dict):
|
|||||||
def extract(gpsifd):
|
def extract(gpsifd):
|
||||||
if item:=is_present(gpsifd): # walrus
|
if item:=is_present(gpsifd): # walrus
|
||||||
n, d = item
|
n, d = item
|
||||||
return n/d
|
if d:
|
||||||
|
return n/d
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def rational(tup):
|
def rational(tup):
|
||||||
nom, denom = tup
|
nom, denom = tup
|
||||||
return nom/denom
|
if denom:
|
||||||
|
return nom/denom
|
||||||
|
return None
|
||||||
|
|
||||||
def rationalise(item):
|
def rationalise(item):
|
||||||
df, mf, sf = item
|
df, mf, sf = item
|
||||||
@@ -195,7 +198,10 @@ def extract_gps(dict):
|
|||||||
|
|
||||||
if item := is_present("GPSTimeStamp"):
|
if item := is_present("GPSTimeStamp"):
|
||||||
h, m, s = rationalise(item)
|
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:
|
else:
|
||||||
timestamp_utc = f"{ds}"
|
timestamp_utc = f"{ds}"
|
||||||
|
|
||||||
|
|||||||
@@ -229,16 +229,10 @@ def load_people_expos():
|
|||||||
pe_list.append(PersonExpedition(person=p, expedition=expedition, noncaver=noncaver))
|
pe_list.append(PersonExpedition(person=p, expedition=expedition, noncaver=noncaver))
|
||||||
PersonExpedition.objects.bulk_create(pe_list)
|
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()
|
ensure_users_are_persons()
|
||||||
most_recent = Expedition.objects.all().first()
|
most_recent = Expedition.objects.all().first()
|
||||||
print(most_recent)
|
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)
|
check_new_signups(expedition)
|
||||||
# pr.disable()
|
# pr.disable()
|
||||||
# with open("folk_reader.prof", "w") as f:
|
# with open("folk_reader.prof", "w") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user