mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-13 20:47:08 +00:00
Fully working dj 1.11.29
This commit is contained in:
@@ -76,9 +76,10 @@ def GetTripCave(place):
|
||||
return tripCaveRes[correctIndex]
|
||||
else:
|
||||
print(("No cave found for place " , place))
|
||||
return
|
||||
return None
|
||||
|
||||
# lookup function modelled on GetPersonExpeditionNameLookup
|
||||
# repeated assignment each call, needs refactoring
|
||||
Gcavelookup = None
|
||||
def GetCaveLookup():
|
||||
global Gcavelookup
|
||||
@@ -91,19 +92,28 @@ def GetCaveLookup():
|
||||
Gcavelookup[cave.kataster_number] = cave
|
||||
if cave.unofficial_number:
|
||||
Gcavelookup[cave.unofficial_number] = cave
|
||||
|
||||
# These are exact matches! edit to check for prefix only!
|
||||
Gcavelookup["tunnocks"] = Gcavelookup["258"]
|
||||
Gcavelookup["hauchhole"] = Gcavelookup["234"]
|
||||
Gcavelookup["KH"] = Gcavelookup["161"]
|
||||
Gcavelookup["Balcony"] = Gcavelookup["264"]
|
||||
Gcavelookup["Balkon"] = Gcavelookup["264"]
|
||||
Gcavelookup["FGH"] = Gcavelookup["290"]
|
||||
Gcavelookup["GSH"] = Gcavelookup["291"]
|
||||
Gcavelookup["Homecoming"] = Gcavelookup["2018-dm-07"]
|
||||
return Gcavelookup
|
||||
|
||||
|
||||
logentries = [] # the entire logbook for one year is a single object: a list of entries
|
||||
noncaveplaces = [ "Journey", "Loser Plateau" ]
|
||||
noncaveplaces = [ "QMplaceholder", "Journey", "Loser Plateau", "UNKNOWN", 'plateau',
|
||||
'base camp', 'basecamp', 'top camp', 'topcamp' ]
|
||||
logdataissues = {}
|
||||
trips ={}
|
||||
|
||||
def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_underground, entry_type="wiki"):
|
||||
""" saves a logbook entry and related persontrips """
|
||||
""" saves a logbook entry and related persontrips
|
||||
Does NOT save the expeditionday_id - all NULLs. why?
|
||||
"""
|
||||
|
||||
trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground)
|
||||
if not author:
|
||||
@@ -112,16 +122,23 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
|
||||
DataIssue.objects.create(parser='logbooks', message=message)
|
||||
return
|
||||
|
||||
#tripCave = GetTripCave(place)
|
||||
# This needs attention. The slug field is derived from 'title'
|
||||
# both GetCaveLookup() and GetTripCave() need to work together better. None of this data is *used* though?
|
||||
#tripCave = GetTripCave(place):
|
||||
|
||||
lplace = place.lower()
|
||||
cave=None
|
||||
if lplace not in noncaveplaces:
|
||||
cave=GetCaveLookup().get(lplace)
|
||||
cave = GetCaveLookup().get(lplace)
|
||||
# message = " ! - '" + lplace + "' place not in noncaveplaces."
|
||||
# print(message)
|
||||
# DataIssue.objects.create(parser='logbooks', message=message)
|
||||
|
||||
#Check for an existing copy of the current entry, and save
|
||||
expeditionday = expedition.get_expedition_day(date)
|
||||
lookupAttribs={'date':date, 'title':title}
|
||||
nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave':cave, 'slug':slugify(title)[:50], 'entry_type':entry_type}
|
||||
# 'cave' is converted to a string doing this, which renders as the cave slug.
|
||||
nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug':slugify(title)[:50], 'entry_type':entry_type}
|
||||
lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user