mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 13:37:09 +00:00
Signup adds person to current expedition
This commit is contained in:
@@ -58,11 +58,6 @@ LOGBOOK_PARSER_SETTINGS = {
|
||||
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
|
||||
|
||||
ENTRIES = {
|
||||
"2029": 0,
|
||||
"2028": 0,
|
||||
"2027": 0,
|
||||
"2026": 0,
|
||||
"2025": 0,
|
||||
"2024": 125,
|
||||
"2023": 131,
|
||||
"2022": 94,
|
||||
@@ -106,6 +101,10 @@ ENTRIES = {
|
||||
"1979": 30,
|
||||
"1978": 38,
|
||||
}
|
||||
for y in range(2025, 2050):
|
||||
y_str = str(y)
|
||||
if y_str not in ENTRIES:
|
||||
ENTRIES[y_str] = 0
|
||||
# What about 1970s ! Yes, 80 and 81 are missing, so are 1976 and 1977.
|
||||
|
||||
logentries = [] # the entire logbook for one year is a single object: a list of entries
|
||||
|
||||
@@ -10,6 +10,7 @@ from django.db import models
|
||||
from unidecode import unidecode
|
||||
|
||||
from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition
|
||||
from troggle.core.views.signup import read_signups
|
||||
|
||||
"""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.
|
||||
@@ -94,8 +95,6 @@ def troggle_slugify(longname):
|
||||
|
||||
def load_people_expos():
|
||||
"""This is where the folk.csv file is parsed to read people's names.
|
||||
Which it gets wrong for people like Lydia-Clare Leather and various 'von' and 'de' middle 'names'
|
||||
and McLean and Mclean and McAdam - interaction with the url parser in urls.py too
|
||||
|
||||
This is ALSO where all the Expedition objects get created. So this is the point at which troggle
|
||||
gets told what expeditions exist.
|
||||
@@ -116,6 +115,7 @@ def load_people_expos():
|
||||
if nexpos <= 0:
|
||||
print(" - Creating expeditions")
|
||||
for year in years:
|
||||
year = year.strip()
|
||||
coUniqueAttribs = {"year": year}
|
||||
otherAttribs = {"name": f"CUCC expo {year}"}
|
||||
e = Expedition.objects.create(**otherAttribs, **coUniqueAttribs)
|
||||
@@ -176,10 +176,22 @@ def load_people_expos():
|
||||
pe = PersonExpedition.objects.create(**coUniqueAttribs)
|
||||
print("", flush=True)
|
||||
ensure_users_are_persons()
|
||||
most_recent = Expedition.objects.all().first()
|
||||
check_new_signups(most_recent)
|
||||
|
||||
def check_new_signups(expedition):
|
||||
signups_clear = read_signups()
|
||||
# print(signups_clear)
|
||||
for slug in signups_clear:
|
||||
print(slug)
|
||||
p = Person.objects.get(slug=slug)
|
||||
pe = PersonExpedition.objects.update_or_create(person=p, expedition=expedition)
|
||||
# print("ADDING ",pe, expedition)
|
||||
|
||||
|
||||
def ensure_users_are_persons():
|
||||
# Just ensure this is up to date.
|
||||
print(f"# ensure_users_are_persons()")
|
||||
print(f"# ensure_users_are_persons() - except for expo and expoadmin of course")
|
||||
users = User.objects.all()
|
||||
for u in users:
|
||||
ps = Person.objects.filter(slug=u.username)
|
||||
@@ -197,7 +209,6 @@ def who_is_this(year, possibleid):
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def when_on_expo(name):
|
||||
"""Returns a list of PersonExpedition objects for the string, if recognised as a name
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user