rename ScansFolder class as Wallet

This commit is contained in:
Philip Sargent
2021-04-26 18:18:16 +01:00
parent dc840c9bc7
commit 0997fd0901
5 changed files with 19 additions and 19 deletions

View File

@@ -17,7 +17,7 @@ from troggle.core.utils import get_process_memory, chaosmonkey
from troggle.parsers.people import GetPersonExpeditionNameLookup
from troggle.parsers.logbooks import GetCaveLookup
from troggle.core.models.troggle import DataIssue, Expedition
from troggle.core.models.survex import SurvexPersonRole, ScansFolder, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation
from troggle.core.models.survex import SurvexPersonRole, Wallet, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation
'''Imports the tree of survex files following form a defined root .svx file
It does also NOT scan the Loser repo for all the svx files - though it should !
@@ -473,7 +473,7 @@ class LoadingSurvex():
message = " ! Wallet *REF {} - not numeric in '{}'".format(refscan, survexblock.survexfile.path)
print((self.insp+message))
DataIssue.objects.create(parser='survex', message=message)
manyscansfolders = ScansFolder.objects.filter(walletname=refscan)
manyscansfolders = Wallet.objects.filter(walletname=refscan)
if manyscansfolders:
survexblock.scansfolder = manyscansfolders[0] # this is a ForeignKey field
print(manyscansfolders[0])

View File

@@ -10,7 +10,7 @@ from PIL import Image
from functools import reduce
import settings
from troggle.core.models.survex import SingleScan, ScansFolder, DrawingFile
from troggle.core.models.survex import SingleScan, Wallet, DrawingFile
from troggle.core.models.troggle import DataIssue
from troggle.core.utils import save_carefully
@@ -85,11 +85,11 @@ def LoadListScans():
print(' - Loading Survey Scans')
SingleScan.objects.all().delete()
ScansFolder.objects.all().delete()
Wallet.objects.all().delete()
print(' - deleting all scansFolder and scansSingle objects')
# first do the smkhs (large kh survey scans) directory
manyscansfoldersmkhs = ScansFolder(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs")
manyscansfoldersmkhs = Wallet(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs")
print("smkhs", end=' ')
if os.path.isdir(manyscansfoldersmkhs.fpath):
manyscansfoldersmkhs.save()
@@ -107,13 +107,13 @@ def LoadListScans():
print("%s" % f, end=' ')
for fy, ffy, fisdiry in GetListDir(ff):
if fisdiry:
scansfolder = ScansFolder(fpath=ffy, walletname=fy)
scansfolder = Wallet(fpath=ffy, walletname=fy)
scansfolder.save()
LoadListScansFile(scansfolder)
# do the
elif f != "thumbs":
scansfolder = ScansFolder(fpath=ff, walletname=f)
scansfolder = Wallet(fpath=ff, walletname=f)
scansfolder.save()
LoadListScansFile(scansfolder)
@@ -125,7 +125,7 @@ def find_tunnel_scan(dwgfile, path):
scansfolder, scansfile = None, None
mscansdir = re.search(r"(\d\d\d\d#X?\d+\w?|1995-96kh|92-94Surveybookkh|1991surveybook|smkhs)/(.*?(?:png|jpg|pdf|jpeg))$", path)
if mscansdir:
scansfolderl = ScansFolder.objects.filter(walletname=mscansdir.group(1))
scansfolderl = Wallet.objects.filter(walletname=mscansdir.group(1))
# This should properly detect if a list of folders is returned and do something sensible, not just pick the first.
if len(scansfolderl):
scansfolder = scansfolderl[0]