splays and alias splays implemented

This commit is contained in:
Philip Sargent
2020-07-04 13:31:46 +01:00
parent 51d0daafdd
commit 5be41c8163
11 changed files with 125 additions and 143 deletions

View File

@@ -71,24 +71,6 @@ def stats(request):
statsDict['caveCount'] = "{:,}".format(Cave.objects.count())
statsDict['personCount'] = "{:,}".format(Person.objects.count())
statsDict['logbookEntryCount'] = "{:,}".format(LogbookEntry.objects.count())
try:
blockroots = SurvexBlock.objects.filter(name="rootblock")
if len(blockroots)>1:
print(" ! more than one root survexblock {}".format(len(blockroots)))
for sbr in blockroots:
print("{} {} {} {}".format(sbr.id, sbr.name, sbr.legsall, sbr.date))
sbr = blockroots[0]
totalsurvexlength = sbr.totalleglength
nimportlegs = sbr.legsall
except:
# if no files yet imported into database
#survexfile = models_survex.SurvexFile(path=settings.SURVEX_TOPNAME, cave=None)
#survexblockdummy = models_survex.SurvexBlock(name="dummy", survexpath="", cave=None, survexfile=survexfile,
#legsall=0, legssplay=0, legssurfc=0, totalleglength=0.0)
#sbr = survexblockdummy
totalsurvexlength = 0.0
nimportlegs = -1
print("{} {} {} {}".format(sbr.id, sbr.name, sbr.legsall, sbr.date))
legsbyexpo = [ ]
addupsurvexlength = 0
@@ -97,7 +79,7 @@ def stats(request):
legsyear=0
survexleglength = 0.0
for survexblock in survexblocks:
survexleglength += survexblock.totalleglength
survexleglength += survexblock.legslength
try:
legsyear += int(survexblock.legsall)
except:
@@ -107,5 +89,5 @@ def stats(request):
"survexleglength":"{:,.0f}".format(survexleglength)}))
legsbyexpo.reverse()
renderDict = {**statsDict, **{ "nsurvexlegs": "{:,}".format(nimportlegs), "totalsurvexlength":totalsurvexlength/1000, "addupsurvexlength":addupsurvexlength/1000, "legsbyexpo":legsbyexpo }} # new syntax
renderDict = {**statsDict, **{ "addupsurvexlength":addupsurvexlength/1000, "legsbyexpo":legsbyexpo }} # new syntax
return render(request,'statistics.html', renderDict)