summaryrefslogtreecommitdiffstats
path: root/core/models_millenial.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/models_millenial.py')
-rw-r--r--core/models_millenial.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/core/models_millenial.py b/core/models_millenial.py
new file mode 100644
index 0000000..db893bc
--- /dev/null
+++ b/core/models_millenial.py
@@ -0,0 +1,66 @@
+from django.db import models
+from django.conf import settings
+
+from troggle.core.methods_millenial import *
+
+#
+# This file was created in 2019
+# It's a result of massive frustration with cluttered database of troggle
+# Maximal clarity of code was primary goal (previous code had very little comments)
+# Maximal speed of database rebuild was secondary goal
+#
+
+#
+# The following file will tell you what fields and methods are avaliable inside this database
+# be carefull you might miss some! ManyToMany fields can be used from the far end as well
+#
+
+
+#
+# Naming conventions:
+# (Upper/lower convention)
+# Class names are writen Udddd_ddd_dddM - they finish with M for backwards compatibility
+# Fields/methods are written lower_lower_lower
+#
+
+class PersonM(models.Model): #instance of this class corresponds to one physical peson
+ name = models.CharField(max_length=100) #just name, talk to wookey if you diagree
+ surveys_made = models.ManyToManyField('SurveyM', related_name='people_surveyed') #links to survey objects that this person made (made=:survex says so)
+ expos_attended = models.ManyToManyField('ExpeditionM', related_name='people_attended') #expos attended by this person (attended=:folk.csv says so)
+ logbook_entries_written = models.ManyToManyField('Logbook_entryM', related_name='people_wrote') #links to logbook chuncks created by a person
+
+class CaveM(models.Model): #instance of this class corresponds to one 'thing' that people call cave
+ entrance = models.CharField(max_length=100) #UTM string describing ONE(!) entrance. Purpose = findability
+ title = models.TextField() #title given to the topmost survey in survex, numeric name otherwise c.f. name (e.g. 'Fishface')
+ name = models.TextField() #name given to the topmost survey in survex (e.g. '2017-cucc-28')
+ surveys = models.ManyToManyField('SurveyM', related_name='cave_parent') #links to surveys objects that this cave contains
+ survex_file = models.TextField() #gives path to top level survex file
+ total_length = models.FloatField() #holds total length of this cave (as given by cavern)
+ total_depth = models.FloatField() #holds total depth of this cave (as given by cavern)
+ description = models.TextField() #holds decription of the cave
+ def top_camp_distance(self): #returns distance of this cave from topcamp
+ return 0
+ def top_camp_bearing(self): #returns bearing to this cave from topcamp in format 235.5 (float north-based azimuth)
+ return 0
+ def top_camp_bearing_letter(self): #returns bearing to this cave from topcamp in format e.g. 'NE'
+ return 0
+ def last_visit(self): #returns Survey class instance of the most recent visit
+ return 0
+
+class ExpeditionM(models.Model): #instance of this class corresponds to one expo (usually one year)
+ date = models.CharField(max_length=100) #date in format YYYY.MM.DD-YYYY.MM.DD
+
+
+class SurveyM(models.Model): #instance of this class corresponds to one .svx file - one trip
+ date = models.CharField(max_length=100) #date of the trip in format YYYY.MM.DD (dated:=date given by .svx file)
+ maxdepth = models.FloatField() #represents max depth of a node in this survey
+
+class Logbook_entryM(models.Model): #instance of this class corresponds to one bit of logbook (c.f. expo.survex.com/years/2015/logbook.html or simil)
+ date = models.CharField(max_length=100) #date as typed into logbook
+ title = models.TextField() #contents of the logbook chunk
+
+class Parser_messageM(models.Model): #instance of this class contains one error or warining message produce by any of the parsers
+ parsername = models.CharField(max_length = 20) #name of parser
+ content = models.TextField() #content of message
+ message_type = models.CharField(max_length = 10) # [Error,Info] or similar
+