forked from expo/troggle
moved aliases to people module, faster db too
This commit is contained in:
@@ -8,7 +8,6 @@ from django.conf import settings
|
||||
from unidecode import unidecode
|
||||
|
||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||
from troggle.core.utils import save_carefully
|
||||
|
||||
"""These functions do not match how the stand-alone folk script works. So the script produces an HTML file which has
|
||||
href links to pages in troggle which troggle does not think are right.
|
||||
@@ -74,17 +73,15 @@ def load_people_expos():
|
||||
headers = next(personreader)
|
||||
header = dict(list(zip(headers, list(range(len(headers))))))
|
||||
|
||||
# make expeditions
|
||||
print(" - Loading expeditions")
|
||||
years = headers[5:]
|
||||
nexpos = Expedition.objects.count()
|
||||
if nexpos <= 0:
|
||||
print(" - Creating expeditions")
|
||||
for year in years:
|
||||
lookupAttribs = {"year": year}
|
||||
nonLookupAttribs = {"name": f"CUCC expo {year}"}
|
||||
e = Expedition.objects.create(**nonLookupAttribs, **lookupAttribs)
|
||||
|
||||
for year in years:
|
||||
lookupAttribs = {"year": year}
|
||||
nonLookupAttribs = {"name": f"CUCC expo {year}"}
|
||||
|
||||
save_carefully(Expedition, lookupAttribs, nonLookupAttribs)
|
||||
|
||||
# make persons
|
||||
print(" - Loading personexpeditions")
|
||||
|
||||
for personline in personreader:
|
||||
@@ -116,7 +113,7 @@ def load_people_expos():
|
||||
|
||||
lookupAttribs = {"first_name": firstname, "last_name": (lastname or "")}
|
||||
nonLookupAttribs = {"is_vfho": vfho, "fullname": fullname, "nickname": nickname}
|
||||
person, created = save_carefully(Person, lookupAttribs, nonLookupAttribs)
|
||||
person = Person.objects.create(**nonLookupAttribs, **lookupAttribs)
|
||||
|
||||
parse_blurb(personline=personline, header=header, person=person)
|
||||
|
||||
@@ -126,7 +123,7 @@ def load_people_expos():
|
||||
if attended == "1" or attended == "-1":
|
||||
lookupAttribs = {"person": person, "expedition": expedition}
|
||||
nonLookupAttribs = {"nickname": nickname, "is_guest": (personline[header["Guest"]] == "1")}
|
||||
save_carefully(PersonExpedition, lookupAttribs, nonLookupAttribs)
|
||||
pe = PersonExpedition.objects.create(**nonLookupAttribs, **lookupAttribs)
|
||||
print("", flush=True)
|
||||
|
||||
|
||||
@@ -289,8 +286,19 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
possnames.append("eric c. landgraf")
|
||||
possnames.append("eric c landgraf")
|
||||
if f"{f} {l}" == "Nadia Raeburn".lower():
|
||||
possnames.append("tinywoman")
|
||||
possnames.append("nadia rc")
|
||||
possnames.append("nadia raeburn-cherradi")
|
||||
if f"{f} {l}" == "Phil Wigglesworth".lower():
|
||||
possnames.append("wiggy")
|
||||
if f"{f} {l}" == "Elaine Oliver".lower():
|
||||
possnames.append("cavingpig")
|
||||
if f"{f} {l}" == "Tom Crossley".lower():
|
||||
possnames.append("tcacrossley")
|
||||
if f"{f} {l}" == "Rob Watson".lower():
|
||||
possnames.append("nobrotson")
|
||||
if f"{f} {l}" == "Todd Rye".lower():
|
||||
possnames.append("samouse1")
|
||||
|
||||
for i in [3, 4, 5, 6]:
|
||||
lim = min(i, len(f) + 1) # short form, e.g. Dan for Daniel.
|
||||
|
||||
Reference in New Issue
Block a user