summaryrefslogtreecommitdiffstats
path: root/core/models/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2022-12-23 23:32:59 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2022-12-23 23:32:59 +0000
commit5bbb363f12c691ead1dce423dc4836cbd7470c84 (patch)
tree7e23593786dbebddf2ab75ecc140afc9f9baecfb /core/models/survex.py
parent0e29cdd48cb4e2abcae82cf084847e77773257ad (diff)
downloadtroggle-5bbb363f12c691ead1dce423dc4836cbd7470c84.tar.gz
troggle-5bbb363f12c691ead1dce423dc4836cbd7470c84.tar.bz2
troggle-5bbb363f12c691ead1dce423dc4836cbd7470c84.zip
Adding docstrings, deleting unused code
Diffstat (limited to 'core/models/survex.py')
-rw-r--r--core/models/survex.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index 3c6ba47..c2a68bf 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -109,6 +109,8 @@ class SurvexBlockLookUpManager(models.Manager):
return block
class SurvexBlock(models.Model):
+ """One begin..end block within a survex file. The basic elemt of a survey trip.
+ """
objects = SurvexBlockLookUpManager()
name = models.CharField(max_length=100)
title = models.CharField(max_length=200)
@@ -141,15 +143,6 @@ class SurvexBlock(models.Model):
def isSurvexBlock(self): # Function used in templates
return True
- def GetPersonroles(self):
- '''
- But apparently never used !?
- '''
- res = [ ]
- for personrole in self.survexpersonrole_set.order_by('personexpedition'):
- res.append({'person':personrole.personexpedition.person, 'expeditionyear':personrole.personexpedition.expedition.year})
- return res
-
def DayIndex(self):
return list(self.expeditionday.survexblock_set.all()).index(self)
@@ -181,6 +174,8 @@ class Wallet(models.Model):
return urljoin(settings.URL_ROOT, reverse('singlewallet', kwargs={"path":re.sub("#", "%23", self.walletname)}))
def get_json(self):
+ """Read the JSON file for the wallet and do stuff
+ """
#jsonfile = Path(self.fpath, 'contents.json')
# Get from git repo instead
@@ -246,6 +241,8 @@ class Wallet(models.Model):
# Yes this is horribly, horribly inefficient, esp. for a page that have date, people and cave in it
def date(self):
+ """Reads all the JSON data just to get the JSNON date.
+ """
if self.walletdate:
return self.walletdate
if not self.get_json():
@@ -319,6 +316,8 @@ class Wallet(models.Model):
return result
def get_ticks(self):
+ """Reads all the JSON data and sets the colour of the completion tick for each condition
+ """
ticks = {}
waldata = self.get_json()
if not waldata:
@@ -438,6 +437,8 @@ class Wallet(models.Model):
return "[" + str(self.walletname) + " (Wallet)]"
class SingleScan(models.Model):
+ """A single file holding an image. Could be raw notes, an elevation plot or whatever
+ """
ffile = models.CharField(max_length=200)
name = models.CharField(max_length=200)
wallet = models.ForeignKey("Wallet", null=True,on_delete=models.SET_NULL)
@@ -449,9 +450,11 @@ class SingleScan(models.Model):
return urljoin(settings.URL_ROOT, reverse('scansingle', kwargs={"path":re.sub("#", "%23", self.wallet.walletname), "file":self.name}))
def __str__(self):
- return "Survey Scan Image: " + str(self.name) + " in " + str(self.wallet)
+ return "Scan Image: " + str(self.name) + " in " + str(self.wallet)
class DrawingFile(models.Model):
+ """A file holding a Therion (several types) or a Tunnel drawing
+ """
dwgpath = models.CharField(max_length=200)
dwgname = models.CharField(max_length=200)
dwgwallets = models.ManyToManyField("Wallet") # implicitly links via folders to scans to SVX files