summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-01-26 13:38:10 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2025-01-26 13:38:10 +0000
commit3ad75d4439ae0d8bc1580c0494cdacd62b1d9a58 (patch)
treef1caf3625d48f7148bce809a02d1387a4a72e01b /parsers
parent4f1d808720e5e48aa4c19b441d636b14a2adb977 (diff)
downloadtroggle-3ad75d4439ae0d8bc1580c0494cdacd62b1d9a58.tar.gz
troggle-3ad75d4439ae0d8bc1580c0494cdacd62b1d9a58.tar.bz2
troggle-3ad75d4439ae0d8bc1580c0494cdacd62b1d9a58.zip
add prior expo experience (readonly)
Diffstat (limited to 'parsers')
-rw-r--r--parsers/users.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/parsers/users.py b/parsers/users.py
index 27a4dea..f3947ff 100644
--- a/parsers/users.py
+++ b/parsers/users.py
@@ -8,7 +8,8 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
-from troggle.core.models.troggle import DataIssue, Person
+from troggle.core.models.troggle import DataIssue, Person, PersonExpedition
+from troggle.core.utils import current_expo
"""This imports the registered troggle users, who are nearly-all, but not quite, Persons.
exceptions are "expo" and "expoadmin" which are created by the databaseReset.py import program.
@@ -19,12 +20,16 @@ Passwords are only ever stored as hashes using the standard Django functions.
"""
todo = """
-- Make all this work with New people who have never been on expo before
+- Not fully tested, needs experience
"""
USERS_FILE = "users.json"
ENCRYPTED_DIR = "encrypted"
+def how_many_previous_expos(person):
+ return PersonExpedition.objects.filter(person=person).exclude(expedition__year=current_expo()).count()
+
+
def register_user(u, email, password=None, pwhash=None, fullname=""):
"""Create User and we may not have a Person to tie it to if it is a future caver.
Do not use the lastname field, put the whole free text identification into firstname