summaryrefslogtreecommitdiffstats
path: root/core/views/scans.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-09-22 00:23:22 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-09-22 00:23:22 +0300
commit1971f51b5281dc64193105ba1cf4a172efeb4b18 (patch)
tree4b5bf7fe9091d8bb42de9902290a2dd34e002e37 /core/views/scans.py
parent11b1d41a55af642eac53243d60d4851ef669e12f (diff)
downloadtroggle-1971f51b5281dc64193105ba1cf4a172efeb4b18.tar.gz
troggle-1971f51b5281dc64193105ba1cf4a172efeb4b18.tar.bz2
troggle-1971f51b5281dc64193105ba1cf4a172efeb4b18.zip
find more wallets than we thought we had
Diffstat (limited to 'core/views/scans.py')
-rw-r--r--core/views/scans.py39
1 files changed, 23 insertions, 16 deletions
diff --git a/core/views/scans.py b/core/views/scans.py
index d3fd517..4e256a6 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -11,6 +11,7 @@ from django.http import HttpResponse
from troggle.core.models.survex import Wallet, SingleScan, SurvexBlock
from troggle.core.models.troggle import Person, Expedition
+from troggle.core.models.troggle import DataIssue
from troggle.core.models.caves import GetCaveLookup
from troggle.core.views.expo import getmimetype
#from troggle.parsers.people import GetPersonExpeditionNameLookup
@@ -89,7 +90,7 @@ def fillblankpeople(w):
# print(f' - {wp=}')
nobody = wp[0].lower()
if nobody == 'unknown' or nobody == 'nobody' or nobody == ' ' or nobody == '':
- print(f' - {wp=} {nobody=}')
+ # print(f' - {wp=} {nobody=}')
populatewallet(w)
def fillblankothers(w):
@@ -100,7 +101,7 @@ def fillblankothers(w):
c = w.cave()
if not c or c == "":
caveifywallet(w)
-
+
def fixsurvextick(w, ticks):
ticks["S"] = w.fixsurvextick(ticks["S"])
@@ -181,10 +182,27 @@ def cavewallets(request, caveid):
else:
return render(request,'errors/badslug.html', {'badslug': caveid})
- # remove duplication. SOrting is done in the template
- wallets = set(Wallet.objects.filter(survexblock__survexfile__cave=cave)) # NB a filtered set
- manywallets = list(wallets)
+ # remove duplication. Sorting is done in the template
+ # But this only gets wallets which have survex files attached..
+ wallets = set(Wallet.objects.filter(survexblock__survexfile__cave=cave))
+
+ # all the ones without a survexblock attached via a *ref, search for match in JSON
+ zilchwallets = set(Wallet.objects.exclude(survexblock__survexfile__cave=cave))
+ for z in zilchwallets:
+ zcave = z.cave()
+ if zcave:
+ if str(zcave) in Gcavelookup:
+ fcave = Gcavelookup[str(zcave)]
+ if str(fcave.slug()) == caveid:
+ # print(f' - Found one ! {z.walletname=} {zcave=}')
+ wallets.add(z)
+ else:
+ wurl = f"/scanupload/{z.walletname.replace('#',':')}"
+ print(f' - Unrecognised cave name \'{zcave}\' in {z.walletname}')
+ message = f" ! In {z.walletname} there is an unrecognised cave name '{zcave}'"
+ DataIssue.objects.update_or_create(parser='scans', message=message, url=wurl)
+ manywallets = list(set(wallets))
for w in manywallets:
fillblankpeople(w)
fillblankothers(w)
@@ -205,21 +223,10 @@ def oldwallet(request, path):
message = f'Scan folder error or not found \'{path}\' .'
return render(request, 'errors/generic.html', {'message': message})
-# def walletindex(request, path):
- # '''All years: special 'wallet' for *scanned* index pages
- # '''
- # print(f'! - walletindex path:{path}')
- # try:
- # wallet = Wallet.objects.get(walletname=urlunquote(path))
- # return render(request, 'walletindex.html', { 'wallet':wallet, 'settings': settings })
- # except:
- # message = f'Scan folder (wallet) error or not found \'{path}\' .'
- # return render(request, 'errors/generic.html', {'message': message})
def scansingle(request, path, file):
'''sends a single binary file to the user for display - browser decides how using mimetype
'''
-
try:
wallet = Wallet.objects.get(walletname=urlunquote(path))
singlescan = SingleScan.objects.get(wallet=wallet, name=file)