mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-12-12 00:27:57 +00:00
[svn r8036] we can parse one 2004 logbook in here. corrections made to folk.csv
This commit is contained in:
@@ -12,27 +12,19 @@ class Expedition(models.Model):
|
||||
return self.year
|
||||
|
||||
def GetPersonExpedition(self, name):
|
||||
if name == "Dour":
|
||||
name = "Anthony Day"
|
||||
personyears = PersonExpedition.objects.filter(expedition=self)
|
||||
personexpeditions = PersonExpedition.objects.filter(expedition=self)
|
||||
res = None
|
||||
for personyear in personyears:
|
||||
if name == "%s %s" % (personyear.person.first_name, personyear.person.last_name):
|
||||
assert not res, "Ambiguous:" + name
|
||||
res = personyear
|
||||
if name == "%s %s" % (personyear.person.first_name, personyear.person.last_name[0]):
|
||||
assert not res, "Ambiguous:" + name
|
||||
res = personyear
|
||||
if name == personyear.person.first_name:
|
||||
assert not res, "Ambiguous:" + name
|
||||
res = personyear
|
||||
for personexpedition in personexpeditions:
|
||||
for possiblenameform in personexpedition.GetPossibleNameForms():
|
||||
if name == possiblenameform:
|
||||
assert not res, "Ambiguous: " + name
|
||||
res = personexpedition
|
||||
return res
|
||||
|
||||
|
||||
class Person(models.Model):
|
||||
first_name = models.CharField(max_length=100)
|
||||
last_name = models.CharField(max_length=100)
|
||||
is_guest = models.BooleanField()
|
||||
is_vfho = models.BooleanField()
|
||||
mug_shot = models.CharField(max_length=100, blank=True,null=True)
|
||||
def __str__(self):
|
||||
@@ -43,32 +35,47 @@ class PersonExpedition(models.Model):
|
||||
person = models.ForeignKey(Person)
|
||||
from_date = models.DateField(blank=True,null=True)
|
||||
to_date = models.DateField(blank=True,null=True)
|
||||
is_guest = models.BooleanField()
|
||||
nickname = models.CharField(max_length=100,blank=True,null=True)
|
||||
|
||||
def GetPossibleNameForms(self):
|
||||
res = [ ]
|
||||
if self.person.last_name:
|
||||
res.append("%s %s" % (self.person.first_name, self.person.last_name))
|
||||
res.append("%s %s" % (self.person.first_name, self.person.last_name[0]))
|
||||
res.append(self.person.first_name)
|
||||
if self.nickname:
|
||||
res.append(self.nickname)
|
||||
return res
|
||||
|
||||
def __str__(self):
|
||||
return "%s: (%s)" % (self.person, self.expedition)
|
||||
|
||||
|
||||
class LogbookEntry(models.Model):
|
||||
date = models.DateField()
|
||||
author = models.ForeignKey(PersonExpedition,blank=True,null=True)
|
||||
author = models.ForeignKey(PersonExpedition,blank=True,null=True) # the person who writes it up doesn't have to have been on the trip
|
||||
title = models.CharField(max_length=100)
|
||||
|
||||
# this will be a foreign key
|
||||
# this will be a foreign key of the place the logbook is describing
|
||||
place = models.CharField(max_length=100,blank=True,null=True)
|
||||
text = models.TextField()
|
||||
|
||||
#cavers = models.ManyToManyField(PersonYear)
|
||||
#tu = models.CharField(max_length=50)
|
||||
# several PersonTrips point in to this object
|
||||
|
||||
def __str__(self):
|
||||
return "%s: (%s)" % (self.date, self.title)
|
||||
|
||||
class PersonTrip(models.Model):
|
||||
personexpedition = models.ForeignKey(PersonExpedition)
|
||||
place = models.CharField(max_length=100) # this will be a foreign key
|
||||
|
||||
# this will be a foreign key of the place(s) the trip went through
|
||||
# possibly a trip has a plurality of triplets pointing into it
|
||||
place = models.CharField(max_length=100)
|
||||
date = models.DateField()
|
||||
timeunderground = models.CharField(max_length=100)
|
||||
logbookentry = models.ForeignKey(LogbookEntry)
|
||||
|
||||
#is_author = models.BooleanField()
|
||||
is_logbookentryauthor = models.BooleanField()
|
||||
|
||||
def __str__(self):
|
||||
return "%s %s (%s)" % (self.personexpedition, self.place, self.date)
|
||||
|
||||
Reference in New Issue
Block a user