summaryrefslogtreecommitdiffstats
path: root/parsers/people.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-01-28 14:03:46 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2023-01-28 14:03:46 +0000
commitd9a40696627b408170a0bb8f84fe18ae33a1feec (patch)
tree8f22879f7f76877d68194ecabcb4883069c1d99a /parsers/people.py
parent9e71be8169e77ea71d080f3535ee0fce036cf838 (diff)
downloadtroggle-d9a40696627b408170a0bb8f84fe18ae33a1feec.tar.gz
troggle-d9a40696627b408170a0bb8f84fe18ae33a1feec.tar.bz2
troggle-d9a40696627b408170a0bb8f84fe18ae33a1feec.zip
moved aliases to people module, faster db too
Diffstat (limited to 'parsers/people.py')
-rw-r--r--parsers/people.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/parsers/people.py b/parsers/people.py
index 7820956..f5b234c 100644
--- a/parsers/people.py
+++ b/parsers/people.py
@@ -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.