remove autologbooks function

This commit is contained in:
Philip Sargent 2021-04-27 00:31:23 +01:00
parent e6eeaf1674
commit 9e7414e0e0
2 changed files with 3 additions and 29 deletions

View File

@ -159,7 +159,6 @@ def memdumpsql(fn):
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# These functions moved to a different file - not used currently.
# import logbooksdump
# def import_auto_logbooks():
# def dumplogbooks():
# def writeCaves():
@ -352,7 +351,6 @@ def usage():
drawings - read in the Tunnel & Therion files - which scans the survey scans too
survex - read in the survex files - all the survex blocks and entrances x/y/z
autologbooks - Not used. read in autologbooks (what are these?)
dumplogbooks - Not used. write out autologbooks (not working?)
and [runlabel] is an optional string identifying this run of the script
@ -412,8 +410,6 @@ if __name__ == "__main__":
jq.enq("survex",import_loadpos)
elif "drawings" in sys.argv:
jq.enq("drawings",import_drawingsfiles)
elif "autologbooks" in sys.argv: # untested in 2020
import_auto_logbooks()
elif "dumplogbooks" in sys.argv: # untested in 2020
dumplogbooks()
# elif "writecaves" in sys.argv: # untested in 2020 - will overwrite input files!!

View File

@ -3,7 +3,7 @@ import time
import timeit
import settings
"""Two currently unused functions. To be re-engineered to produce a logbook file
"""currently unused function. To be re-engineered to produce a logbook file
in canonical post-2010 Parseloghtmltxt() format after importing from one of the
older more artisanal formats which will then be retired. For example, 2003 used
a unique HTML format and we should regularise this and deprecate the unique parser
@ -20,30 +20,6 @@ from django.urls import reverse
from troggle.core.models.caves import Cave, Entrance
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def import_auto_logbooks():
'''For logbook entries which have been 'typed up' by entering the data in a form,
which makes a copy of the LBE in years/<year>/autologbook/<tripname>.html
this will then re-import all thoise individual LBE files.
Gosh. How complicated. Thank goodness we don't do anything like this anymore.
'''
import os
import troggle.parsers.logbooks
for pt in troggle.core.models.PersonTrip.objects.all():
pt.delete()
for lbe in troggle.core.models.LogbookEntry.objects.all():
lbe.delete()
for expedition in troggle.core.models.Expedition.objects.all():
directory = os.path.join(settings.EXPOWEB,
"years",
expedition.year,
"autologbook")
for root, dirs, filenames in os.walk(directory):
for filename in filenames:
print((os.path.join(root, filename)))
parsers.logbooks.parseAutoLogBookEntry(os.path.join(root, filename))
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Temporary function until definitive source of data transfered.
from django.template.defaultfilters import slugify
@ -53,6 +29,8 @@ def dumplogbooks():
so that they can be re-imported.
This is the sort of silly thing you have to do when you started out thinking that the database was
going to be the Source Of All Truth and then retrofitting to make inthe input files be the master.
To be rewritten to produce a single logbook.html in a modern format
'''
def get_name(pe):
if pe.nickname: