From c66b5e2dadcc7a4b501b479c30f183c3bf81af42 Mon Sep 17 00:00:00 2001 From: goatchurch Date: Wed, 5 Aug 2009 11:58:36 +0100 Subject: [PATCH] [svn] latest hacking for various statistics --- core/models.py | 18 ++- core/models_survex.py | 32 ++++- core/templatetags/wiki_markup.py | 13 +- core/views_logbooks.py | 28 ++++- core/views_survex.py | 3 +- databaseReset.py | 5 +- media/css/main3.css | 5 +- parsers/logbooks.py | 20 +++- parsers/survex.py | 200 +++++++++++++++++++++---------- templates/base.html | 2 +- templates/expedition.html | 14 +++ templates/experimental.html | 26 ++++ templates/personindex.html | 11 +- templates/svxcavesingle.html | 6 +- templates/svxfilecavelist.html | 2 + urls.py | 18 ++- 16 files changed, 303 insertions(+), 100 deletions(-) create mode 100644 templates/experimental.html diff --git a/core/models.py b/core/models.py index 08e4ecd..c60f0ac 100644 --- a/core/models.py +++ b/core/models.py @@ -13,6 +13,7 @@ getcontext().prec=2 #use 2 significant figures for decimal calculations from models_survex import * + def get_related_by_wikilinks(wiki_text): found=re.findall(settings.QM_PATTERN,wiki_text) res=[] @@ -120,6 +121,14 @@ class Person(TroggleModel): def bisnotable(self): return self.notability() > Decimal(1)/Decimal(3) + def surveyedleglength(self): + return sum([personexpedition.surveyedleglength() for personexpedition in self.personexpedition_set.all()]) + + def first(self): + return self.personexpedition_set.order_by('-expedition')[0] + def last(self): + return self.personexpedition_set.order_by('expedition')[0] + #def Sethref(self): #if self.last_name: #self.href = self.first_name.lower() + "_" + self.last_name.lower() @@ -151,11 +160,11 @@ class PersonExpedition(TroggleModel): def GetPersonroles(self): res = [ ] - for personrole in self.personrole_set.order_by('survex_block'): - if res and res[-1]['survexpath'] == personrole.survex_block.survexpath: + for personrole in self.personrole_set.order_by('survexblock'): + if res and res[-1]['survexpath'] == personrole.survexblock.survexpath: res[-1]['roles'] += ", " + str(personrole.role) else: - res.append({'date':personrole.survex_block.date, 'survexpath':personrole.survex_block.survexpath, 'roles':str(personrole.role)}) + res.append({'date':personrole.survexblock.date, 'survexpath':personrole.survexblock.survexpath, 'roles':str(personrole.role)}) return res class Meta: @@ -178,6 +187,9 @@ class PersonExpedition(TroggleModel): def get_absolute_url(self): return urlparse.urljoin(settings.URL_ROOT, reverse('personexpedition',kwargs={'first_name':self.person.first_name,'last_name':self.person.last_name,'year':self.expedition.year})) + def surveyedleglength(self): + survexblocks = [personrole.survexblock for personrole in self.personrole_set.all() ] + return sum([survexblock.totalleglength for survexblock in set(survexblocks)]) # # Single parsed entry from Logbook diff --git a/core/models_survex.py b/core/models_survex.py index 43617f5..ffb3d4d 100644 --- a/core/models_survex.py +++ b/core/models_survex.py @@ -46,6 +46,22 @@ class SurvexFile(models.Model): self.survexdirectory = survexdirectory self.save() +class SurvexEquate(models.Model): + cave = models.ForeignKey('Cave', blank=True, null=True) + +class SurvexStation(models.Model): + name = models.CharField(max_length=20) + block = models.ForeignKey('SurvexBlock') + equate = models.ForeignKey('SurvexEquate', blank=True, null=True) + +class SurvexLeg(models.Model): + block = models.ForeignKey('SurvexBlock') + #title = models.ForeignKey('SurvexTitle') + stationfrom = models.ForeignKey('SurvexStation', related_name='stationfrom') + stationto = models.ForeignKey('SurvexStation', related_name='stationto') + tape = models.FloatField() + compass = models.FloatField() + clino = models.FloatField() # # Single SurvexBlock # @@ -62,6 +78,7 @@ class SurvexBlock(models.Model): begin_char = models.IntegerField() # code for where in the survex data files this block sits survexpath = models.CharField(max_length=200) # the path for the survex stations refscandir = models.CharField(max_length=100) + totalleglength = models.FloatField() class Meta: ordering = ('id',) @@ -78,6 +95,17 @@ class SurvexBlock(models.Model): res.append({'person':personrole.personexpedition.person, 'expeditionyear':personrole.personexpedition.expedition.year, 'roles':str(personrole.role)}) return res + def MakeSurvexStation(self, name): + ssl = self.survexstation_set.filter(name=name) + if ssl: + assert len(ssl) == 1 + return ssl[0] + ss = SurvexStation(name=name, block=self) + ss.save() + return ss + + + class SurvexTitle(models.Model): survexblock = models.ForeignKey('SurvexBlock') title = models.CharField(max_length=200) @@ -87,7 +115,7 @@ class SurvexTitle(models.Model): # member of a SurvexBlock # class PersonRole(models.Model): - survex_block = models.ForeignKey('SurvexBlock') + survexblock = models.ForeignKey('SurvexBlock') ROLE_CHOICES = ( ('insts','Instruments'), @@ -109,6 +137,6 @@ class PersonRole(models.Model): persontrip = models.ForeignKey('PersonTrip', blank=True, null=True) def __unicode__(self): - return unicode(self.person) + " - " + unicode(self.survex_block) + " - " + unicode(self.nrole) + return unicode(self.person) + " - " + unicode(self.survexblock) + " - " + unicode(self.nrole) diff --git a/core/templatetags/wiki_markup.py b/core/templatetags/wiki_markup.py index 1b57e80..3b770a4 100644 --- a/core/templatetags/wiki_markup.py +++ b/core/templatetags/wiki_markup.py @@ -7,9 +7,6 @@ from core.models import QM, Photo, LogbookEntry, Cave import re, urlparse register = template.Library() -url_root=settings.URL_ROOT -if settings.URL_ROOT.endswith('/'): - url_root=settings.URL_ROOT[:-1] @register.filter() @@ -93,7 +90,7 @@ def wiki_to_html_short(value, autoescape=None): [[QM:C204-1999-24]] If the QM does not exist, the function will return a link for creating it. """ - qmdict={'urlroot':url_root,'cave':matchobj.groups()[2],'year':matchobj.groups()[1],'number':matchobj.groups()[3]} + qmdict={'urlroot':settings.URL_ROOT,'cave':matchobj.groups()[2],'year':matchobj.groups()[1],'number':matchobj.groups()[3]} try: qm=QM.objects.get(found_by__cave__kataster_number = qmdict['cave'], found_by__date__year = qmdict['year'], @@ -146,13 +143,13 @@ def wiki_to_html_short(value, autoescape=None): value = re.sub(photoSrcPattern,photoSrcRepl, value, re.DOTALL) #make cave links - value = re.sub("\[\[\s*cave:([^\s]+)\s*\s*\]\]", r'\1' % url_root, value, re.DOTALL) + value = re.sub("\[\[\s*cave:([^\s]+)\s*\s*\]\]", r'\1' % settings.URL_ROOT, value, re.DOTALL) #make people links - value = re.sub("\[\[\s*person:(.+)\|(.+)\]\]",r'\2' % url_root, value, re.DOTALL) + value = re.sub("\[\[\s*person:(.+)\|(.+)\]\]",r'\2' % settings.URL_ROOT, value, re.DOTALL) #make subcave links - value = re.sub("\[\[\s*subcave:(.+)\|(.+)\]\]",r'\2' % url_root, value, re.DOTALL) + value = re.sub("\[\[\s*subcave:(.+)\|(.+)\]\]",r'\2' % settings.URL_ROOT, value, re.DOTALL) #make cavedescription links - value = re.sub("\[\[\s*cavedescription:(.+)\|(.+)\]\]",r'\2' % url_root, value, re.DOTALL) + value = re.sub("\[\[\s*cavedescription:(.+)\|(.+)\]\]",r'\2' % settings.URL_ROOT, value, re.DOTALL) diff --git a/core/views_logbooks.py b/core/views_logbooks.py index 3d7d77f..e5cc4e0 100644 --- a/core/views_logbooks.py +++ b/core/views_logbooks.py @@ -1,7 +1,8 @@ from django.shortcuts import render_to_response from troggle.core.models import Expedition, Person, PersonExpedition, PersonTrip, LogbookEntry +import troggle.core.models as models import troggle.settings as settings -from django.db import models +import django.db.models from troggle.parsers.logbooks import LoadLogbookForExpedition from troggle.parsers.people import GetPersonExpeditionNameLookup from troggle.core.forms import PersonForm @@ -13,7 +14,7 @@ from troggle.alwaysUseRequestContext import render_response import re -@models.permalink #this allows the nice get_absolute_url syntax we are using +@django.db.models.permalink #this allows the nice get_absolute_url syntax we are using def getNotablePersons(): notablepersons = [] @@ -27,7 +28,7 @@ def personindex(request): persons = Person.objects.all() # From what I can tell, "persons" seems to be the table rows, while "personss" is the table columns. - AC 16 Feb 09 personss = [ ] - ncols = 5 + ncols = 4 nc = (len(persons) + ncols - 1) / ncols for i in range(ncols): personss.append(persons[i * nc: (i + 1) * nc]) @@ -76,9 +77,9 @@ def GetPersonChronology(personexpedition): a.setdefault("persontrips", [ ]).append(persontrip) for personrole in personexpedition.personrole_set.all(): - a = res.setdefault(personrole.survex_block.date, { }) + a = res.setdefault(personrole.survexblock.date, { }) b = a.setdefault("personroles", { }) - survexpath = personrole.survex_block.survexpath + survexpath = personrole.survexblock.survexpath if b.get(survexpath): b[survexpath] += ", " + str(personrole.nrole) @@ -135,3 +136,20 @@ def personForm(request,pk): form=PersonForm(instance=person) return render_response(request,'personform.html', {'form':form,}) + +def experimental(request): + legsbyexpo = [ ] + for expedition in Expedition.objects.all(): + survexblocks = expedition.survexblock_set.all() + survexlegs = [ ] + survexleglength = 0.0 + for survexblock in survexblocks: + survexlegs.extend(survexblock.survexleg_set.all()) + survexleglength += survexblock.totalleglength + legsbyexpo.append((expedition, {"nsurvexlegs":len(survexlegs), "survexleglength":survexleglength})) + legsbyexpo.reverse() + + survexlegs = models.SurvexLeg.objects.all() + totalsurvexlength = sum([survexleg.tape for survexleg in survexlegs]) + return render_response(request, 'experimental.html', { "nsurvexlegs":len(survexlegs), "totalsurvexlength":totalsurvexlength, "legsbyexpo":legsbyexpo }) + diff --git a/core/views_survex.py b/core/views_survex.py index d20e3f0..e1f2476 100644 --- a/core/views_survex.py +++ b/core/views_survex.py @@ -113,8 +113,7 @@ class SvxForm(forms.Form): def svx(request, survex_file): # get the basic data from the file given in the URL dirname = os.path.split(survex_file)[0] - if dirname: - dirname += "/" + dirname += "/" nowtime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') outputtype = "normal" form = SvxForm({'filename':survex_file, 'dirname':dirname, 'datetime':nowtime, 'outputtype':outputtype}) diff --git a/databaseReset.py b/databaseReset.py index 021b1a4..855ea47 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -106,7 +106,10 @@ if __name__ == "__main__": reset() elif "survex" in sys.argv: management.call_command('syncdb', interactive=False) # this sets the path so that import settings works in import_survex -# import_survex() + import_survex() + + elif "logbooks" in sys.argv: + management.call_command('syncdb', interactive=False) # this sets the path so that import settings works in import_survex import_logbooks() else: print "Do 'python databaseReset.py reset'" diff --git a/media/css/main3.css b/media/css/main3.css index 7a6704f..4d94049 100644 --- a/media/css/main3.css +++ b/media/css/main3.css @@ -278,7 +278,10 @@ div#content { .toolbarlinks { - padding:0; + padding:5px; + background-color:#ff9; + text-align:center; + font-weight:bold; } .footer { diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 0867686..88816d4 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -40,6 +40,8 @@ def GetTripPersons(trippeople, expedition, logtime_underground): if mul: author = personyear if not author: + if not res: + return None, None author = res[-1][0] return res, author @@ -75,6 +77,10 @@ noncaveplaces = [ "Journey", "Loser Plateau" ] def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_underground): """ saves a logbook entry and related persontrips """ trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground) + if not author: + print "skipping logentry", title + return + # tripCave = GetTripCave(place) # lplace = place.lower() @@ -135,15 +141,20 @@ def Parselogwikitxt(year, expedition, txt): def Parseloghtmltxt(year, expedition, txt): tripparas = re.findall("([\s\S]*?)(?=)? - \s*(.*?) + + s = re.match('''(?x)(?:\s*.*?\s*

)? # second date + \s*(?:)? + \s*(.*?)(?:

)? \s*\s*(.*?) \s*\s*(.*?) ([\s\S]*?) \s*(?:\s*(.*?))? \s*$ ''', trippara) - assert s, trippara + if not s: + print "can't parse: ", trippara # this is 2007 which needs editing + #assert s, trippara + continue tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups() ldate = ParseDate(tripdate.strip(), year) @@ -240,7 +251,7 @@ def Parseloghtml03(year, expedition, txt): yearlinks = [ ("2008", "2008/2008logbook.txt", Parselogwikitxt), - ("2007", "2007/2007logbook.txt", Parselogwikitxt), + ("2007", "2007/logbook.html", Parseloghtmltxt), ("2006", "2006/logbook/logbook_06.txt", Parselogwikitxt), ("2005", "2005/logbook.html", Parseloghtmltxt), ("2004", "2004/logbook.html", Parseloghtmltxt), @@ -326,6 +337,7 @@ def LoadLogbookForExpedition(expedition): if lyear == year: break fin = open(os.path.join(expowebbase, lloc)) + print "opennning", lloc txt = fin.read().decode("latin1") fin.close() parsefunc(year, expedition, txt) diff --git a/parsers/survex.py b/parsers/survex.py index 121ad65..0a764ef 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -6,77 +6,156 @@ import re import os + +def LoadSurvexLineLeg(survexblock, stardata, sline, comment): + ls = sline.lower().split() + ssfrom = survexblock.MakeSurvexStation(ls[stardata["from"]]) + ssto = survexblock.MakeSurvexStation(ls[stardata["to"]]) + + survexleg = models.SurvexLeg(block=survexblock, stationfrom=ssfrom, stationto=ssto) + if stardata["type"] == "normal": + survexleg.tape = float(ls[stardata["tape"]]) + lclino = ls[stardata["clino"]] + lcompass = ls[stardata["compass"]] + if lclino == "up": + survexleg.compass = 0.0 + survexleg.clino = 90.0 + elif lclino == "down": + survexleg.compass = 0.0 + survexleg.clino = -90.0 + elif lclino == "-" or lclino == "level": + survexleg.compass = float(lcompass) + survexleg.clino = -90.0 + else: + assert re.match("[\d\-+.]+$", lcompass), ls + assert re.match("[\d\-+.]+$", lclino) and lclino != "-", ls + survexleg.compass = float(lcompass) + survexleg.clino = float(lclino) + + # only save proper legs + survexleg.save() + + itape = stardata.get("tape") + if itape: + survexblock.totalleglength += float(ls[itape]) + survexblock.save() + +def LoadSurvexEquate(survexblock, sline): + pass + +def LoadSurvexLinePassage(survexblock, stardata, sline, comment): + pass + + +stardatadefault = { "type":"normal", "t":"leg", "from":0, "to":1, "tape":2, "compass":3, "clino":4 } +stardataparamconvert = { "length":"tape", "bearing":"compass", "gradient":"clino" } + def RecursiveLoad(survexblock, survexfile, fin, textlines): iblankbegins = 0 text = [ ] + stardata = stardatadefault teammembers = [ ] + while True: svxline = fin.readline().decode("latin1") if not svxline: return textlines.append(svxline) - mstar = re.match('\s*\*(\w+)\s+(.*?)\s*(?:;.*)?$', svxline) - #;ref.: 2008#18 - mref = re.match('.*?ref.*?(\d+#\d+)', svxline) + # break the line at the comment + sline, comment = re.match("([^;]*?)\s*(?:;\s*(.*))?\n?$", svxline.strip()).groups() + + # detect ref line pointing to the scans directory + mref = comment and re.match('.*?ref.*?(\d+)\s*#\s*(\d+)', comment) if mref: - survexblock.refscandir = mref.group(1) - survexblock.save() - - if mstar: - cmd, line = mstar.groups() - - if re.match("include$(?i)", cmd): - includepath = os.path.join(os.path.split(survexfile.path)[0], re.sub("\.svx$", "", line)) - includesurvexfile = models.SurvexFile(path=includepath, cave=survexfile.cave) - includesurvexfile.save() - includesurvexfile.SetDirectory() - if includesurvexfile.exists(): - fininclude = includesurvexfile.OpenFile() - RecursiveLoad(survexblock, includesurvexfile, fininclude, textlines) - - elif re.match("begin$(?i)", cmd): - if line: - name = line.lower() - survexblockdown = models.SurvexBlock(name=name, begin_char=fin.tell(), parent=survexblock, survexpath=survexblock.survexpath+"."+name, cave=survexblock.cave, survexfile=survexfile) - survexblockdown.save() - textlinesdown = [ ] - RecursiveLoad(survexblockdown, survexfile, fin, textlinesdown) - else: - iblankbegins += 1 - - elif re.match("end$(?i)", cmd): - if iblankbegins: - iblankbegins -= 1 - else: - survexblock.text = "".join(textlines) - survexblock.save() - return - - elif re.match("date$(?i)", cmd): - if len(line) == 10: - survexblock.date = re.sub("\.", "-", line) - expeditions = models.Expedition.objects.filter(year=line[:4]) - if expeditions: - survexblock.expedition = expeditions[0] - - elif re.match("team$(?i)", cmd): - mteammember = re.match("(Insts|Notes|Tape|Dog|Useless|Pics|Helper|Disto|Consultant)\s+(.*)$(?i)", line) - if mteammember: - for tm in re.split(" and | / |, | & | \+ |^both$|^none$(?i)", mteammember.group(2)): - if tm: - personexpedition = survexblock.expedition and GetPersonExpeditionNameLookup(survexblock.expedition).get(tm.lower()) - if (personexpedition, tm) not in teammembers: - teammembers.append((personexpedition, tm)) - personrole = models.PersonRole(survex_block=survexblock, nrole=mteammember.group(1).lower(), personexpedition=personexpedition, personname=tm) - personrole.save() - - elif cmd == "title": - survextitle = models.SurvexTitle(survexblock=survexblock, title=line.strip('"'), cave=survexblock.cave) - survextitle.save() - + survexblock.refscandir = "%s/%s%%23%s" % (mref.group(1), mref.group(1), mref.group(2)) + survexblock.save() + continue + + if not sline: + continue + + # detect the star command + mstar = re.match('\s*\*(\w+)\s*(.*?)\s*(?:;.*)?$', sline) + if not mstar: + if "from" in stardata: + LoadSurvexLineLeg(survexblock, stardata, sline, comment) + elif stardata["type"] == "passage": + LoadSurvexLinePassage(survexblock, stardata, sline, comment) + continue + + # detect the star command + cmd, line = mstar.groups() + if re.match("include$(?i)", cmd): + includepath = os.path.join(os.path.split(survexfile.path)[0], re.sub("\.svx$", "", line)) + includesurvexfile = models.SurvexFile(path=includepath, cave=survexfile.cave) + includesurvexfile.save() + includesurvexfile.SetDirectory() + if includesurvexfile.exists(): + fininclude = includesurvexfile.OpenFile() + RecursiveLoad(survexblock, includesurvexfile, fininclude, textlines) + + elif re.match("begin$(?i)", cmd): + if line: + name = line.lower() + survexblockdown = models.SurvexBlock(name=name, begin_char=fin.tell(), parent=survexblock, survexpath=survexblock.survexpath+"."+name, cave=survexblock.cave, survexfile=survexfile, totalleglength=0.0) + survexblockdown.save() + textlinesdown = [ ] + RecursiveLoad(survexblockdown, survexfile, fin, textlinesdown) else: - assert cmd.lower() in [ "sd", "equate", "include", "units", "entrance", "fix", "data", "flags", "title", "export", "instrument", "calibrate", ], (cmd, line, survexblock) + iblankbegins += 1 + + elif re.match("end$(?i)", cmd): + if iblankbegins: + iblankbegins -= 1 + else: + survexblock.text = "".join(textlines) + survexblock.save() + return + + elif re.match("date$(?i)", cmd): + if len(line) == 10: + survexblock.date = re.sub("\.", "-", line) + expeditions = models.Expedition.objects.filter(year=line[:4]) + if expeditions: + survexblock.expedition = expeditions[0] + + elif re.match("team$(?i)", cmd): + mteammember = re.match("(Insts|Notes|Tape|Dog|Useless|Pics|Helper|Disto|Consultant)\s+(.*)$(?i)", line) + if mteammember: + for tm in re.split(" and | / |, | & | \+ |^both$|^none$(?i)", mteammember.group(2)): + if tm: + personexpedition = survexblock.expedition and GetPersonExpeditionNameLookup(survexblock.expedition).get(tm.lower()) + if (personexpedition, tm) not in teammembers: + teammembers.append((personexpedition, tm)) + personrole = models.PersonRole(survexblock=survexblock, nrole=mteammember.group(1).lower(), personexpedition=personexpedition, personname=tm) + if personexpedition: + personrole.person=personexpedition.person + personrole.save() + + elif cmd == "title": + survextitle = models.SurvexTitle(survexblock=survexblock, title=line.strip('"'), cave=survexblock.cave) + survextitle.save() + + elif cmd == "data": + ls = line.lower().split() + stardata = { "type":ls[0] } + for i in range(0, len(ls)): + stardata[stardataparamconvert.get(ls[i], ls[i])] = i - 1 + if ls[0] in ["normal", "cartesian", "nosurvey"]: + assert "from" in stardata, line + assert "to" in stardata, line + elif ls[0] == "default": + stardata = stardatadefault + else: + assert ls[0] == "passage", line + + elif cmd == "equate": + LoadSurvexEquate(survexblock, sline) + + else: + assert cmd.lower() in [ "sd", "equate", "include", "units", "entrance", "fix", "data", "flags", "title", "export", "instrument", "calibrate", ], (cmd, line, survexblock) + def ReloadSurvexCave(survex_cave): @@ -89,7 +168,7 @@ def ReloadSurvexCave(survex_cave): survexfile.save() survexfile.SetDirectory() - survexblockroot = models.SurvexBlock(name="root", survexpath="caves", begin_char=0, cave=cave, survexfile=survexfile) + survexblockroot = models.SurvexBlock(name="root", survexpath="caves", begin_char=0, cave=cave, survexfile=survexfile, totalleglength=0.0) survexblockroot.save() fin = survexfile.OpenFile() textlines = [ ] @@ -97,6 +176,7 @@ def ReloadSurvexCave(survex_cave): survexblockroot.text = "".join(textlines) survexblockroot.save() + def LoadAllSurvexBlocks(): caves = models.Cave.objects.all() for cave in caves: diff --git a/templates/base.html b/templates/base.html index 3c519d2..b0d1c01 100644 --- a/templates/base.html +++ b/templates/base.html @@ -32,7 +32,7 @@

+
+

Surveys done

+ + +{% for survexblock in expedition.survexblock_set.all %} + + + + + +{% endfor %} +
DateNameLength
{{survexblock.date}}{{survexblock.name}}{{survexblock.totalleglength}}
+
+ {% endblock %} diff --git a/templates/experimental.html b/templates/experimental.html new file mode 100644 index 0000000..d7dbd88 --- /dev/null +++ b/templates/experimental.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% load wiki_markup %} +{% load link %} + +{% block title %}Experimental{% endblock %} + +{% block content %} + +

Expo Experimental

+ +

Number of survey legs: {{nsurvexlegs}}, total length: {{totalsurvexlength}}

+ + + +{% for legs in legsbyexpo %} + + + + + + +{% endfor %} +
YearSurveysSurvey LegsTotal length
{{legs.0.year}}{{legs.0.survexblock_set.all|length}}{{legs.1.nsurvexlegs}}{{legs.1.survexleglength}}
+ +{% endblock %} + diff --git a/templates/personindex.html b/templates/personindex.html index ea97f43..8daffc0 100644 --- a/templates/personindex.html +++ b/templates/personindex.html @@ -11,8 +11,8 @@ {% for person in notablepersons %} {{person|wiki_to_html_short}} - {{ person.personexpedition_set.all.0.expedition.year }} - {{ person.personexpedition_set.latest.expedition.year }} + {{ person.first.expedition.year }} + {{ person.last.expedition.year }} {{person.notability}} {% endfor %} @@ -26,12 +26,13 @@ - + {% for person in persons %} - - + + + {% endfor %}
PersonFirstLast
PersonFirstLastSurveyed length
{{person|wiki_to_html_short}}{{person.personexpedition_set.all.0.expedition.year}}{{person.personexpedition_set.latest.expedition.year}}{{person.first.expedition.year}}{{person.last.expedition.year}}{{ person.surveyedleglength }}
diff --git a/templates/svxcavesingle.html b/templates/svxcavesingle.html index 1b7b350..d0fe827 100644 --- a/templates/svxcavesingle.html +++ b/templates/svxcavesingle.html @@ -18,7 +18,7 @@

{{survexdirectory.path}}

- + {% for survexfile in survexdirectory.survexfile_set.all %} @@ -57,6 +57,8 @@ {% endfor %} + + diff --git a/templates/svxfilecavelist.html b/templates/svxfilecavelist.html index e44fb85..a0db893 100644 --- a/templates/svxfilecavelist.html +++ b/templates/svxfilecavelist.html @@ -7,6 +7,8 @@ {% block content %}

caves with subdirectories | caves with multiple files | caves with single files

+

Link to all.svx for processing

+

Caves with subdirectories

{% for subdircave, cavefiles, subsurvdirs in subdircaves %} diff --git a/urls.py b/urls.py index b4f2ebc..699c448 100644 --- a/urls.py +++ b/urls.py @@ -72,21 +72,24 @@ urlpatterns = patterns('', (r'^accounts/', include('registration.urls')), (r'^profiles/', include('profiles.urls')), + # (r'^personform/(.*)$', personForm), (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), - + url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"), url(r'^survexfile/(?P.*?)\.svx$', views_survex.svx, name="svx"), - url(r'^survexfile/(?P.*)\.3d$', views_survex.threed, name="threed"), - url(r'^survexfile/caves$', views_survex.survexcaveslist, name="survexcaveslist"), + url(r'^survexfile/(?P.*?)\.3d$', views_survex.threed, name="threed"), + url(r'^survexfile/(?P.*?)\.log$', views_survex.svxraw), + url(r'^survexfile/(?P.*?)\.err$', views_survex.err), + + + url(r'^survexfile/caves/$', views_survex.survexcaveslist, name="survexcaveslist"), url(r'^survexfile/caves/(?P.*)$', views_survex.survexcavesingle, name="survexcavessingle"), url(r'^survexfileraw/(?P.*?)\.svx$', views_survex.svxraw, name="svxraw"), - (r'^survex/(?P.*)\.log$', log), - (r'^survex/(?P.*)\.err$', err), (r'^survey_files/listdir/(?P.*)$', view_surveys.listdir), (r'^survey_files/download/(?P.*)$', view_surveys.download), @@ -100,5 +103,8 @@ urlpatterns = patterns('', (r'^photos/(?P.*)$', 'django.views.static.serve', {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), - #url(r'^trip_report/?$',views_other.tripreport,name="trip_report") + # for those silly ideas + url(r'^experimental.*$', views_logbooks.experimental, name="experimental"), + + #url(r'^trip_report/?$',views_other.tripreport,name="trip_report") )
Survex fileBlockDateExplorersTitlesScans
Survex fileBlockDateExplorerslengthTitlesScans
{{survexblock.totalleglength}} {% for survextitle in survexblock.survextitle_set.all %} {{survextitle.title}} @@ -65,7 +67,7 @@ {% if survexblock.refscandir %} - {{survexblock.refscandir}} + scans {% endif %}