mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
more complete list of caves linked to wallets
This commit is contained in:
parent
5c0835e076
commit
b4cf2bac95
@ -28,7 +28,7 @@ from troggle.core.models.survex import SurvexStation
|
||||
from troggle.core.utils import writetrogglefile
|
||||
from troggle.core.utils import TROG
|
||||
|
||||
# Us ethe TROG global object to cache teh cave lookup list
|
||||
# Use the TROG global object to cache the cave lookup list
|
||||
Gcavelookup = TROG['caves']['gcavelookup']
|
||||
Gcave_count = TROG['caves']['gcavecount']
|
||||
|
||||
|
@ -64,13 +64,14 @@ def caveifywallet(w):
|
||||
'''Gets the cave from the list of survex files,
|
||||
only selects one of them though. Only used for display.
|
||||
'''
|
||||
print(f' - Caveify {w=}')
|
||||
blocknames = []
|
||||
blocks = SurvexBlock.objects.filter(scanswallet = w)
|
||||
for b in blocks:
|
||||
# NB b.cave is not populated by parser. Use b.survexfile.cave instead, or we could parse b.survexpath
|
||||
if b.survexfile.cave:
|
||||
w.cave = b.survexfile.cave # just gets the last one, randomly. SHould make this a list or many:many ideally
|
||||
|
||||
w.caveobj = b.survexfile.cave # just gets the last one, randomly. SHould make this a list or many:many ideally
|
||||
w.cave = w.caveobj
|
||||
if b.name:
|
||||
blocknames.append(b.name)
|
||||
|
||||
@ -98,9 +99,18 @@ def fillblankothers(w):
|
||||
if not w.date():
|
||||
datewallet(w, earliest)
|
||||
|
||||
c = w.cave()
|
||||
if not c or c == "":
|
||||
Gcavelookup = GetCaveLookup()
|
||||
|
||||
wcaveid = w.cave()
|
||||
if not wcaveid or wcaveid == "":
|
||||
caveifywallet(w)
|
||||
else:
|
||||
if wcaveid in Gcavelookup:
|
||||
w.caveobj = Gcavelookup[wcaveid]
|
||||
# print(f' - Found cave object from id {wcaveid}')
|
||||
else:
|
||||
print(f' - Failed to find cave object from id {wcaveid}')
|
||||
|
||||
|
||||
def fixsurvextick(w, ticks):
|
||||
ticks["S"] = w.fixsurvextick(ticks["S"])
|
||||
@ -189,17 +199,17 @@ def cavewallets(request, caveid):
|
||||
# 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)]
|
||||
zcaveid = z.cave()
|
||||
if zcaveid:
|
||||
if str(zcaveid) in Gcavelookup:
|
||||
fcave = Gcavelookup[str(zcaveid)]
|
||||
if str(fcave.slug()) == caveid:
|
||||
# print(f' - Found one ! {z.walletname=} {zcave=}')
|
||||
# print(f' - Found one ! {z.walletname=} {zcaveid=}')
|
||||
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}'"
|
||||
print(f' - Unrecognised cave name \'{zcaveid}\' in {z.walletname}')
|
||||
message = f" ! In {z.walletname} there is an unrecognised cave name '{zcaveid}'"
|
||||
DataIssue.objects.update_or_create(parser='scans', message=message, url=wurl)
|
||||
|
||||
manywallets = list(set(wallets))
|
||||
|
@ -30,8 +30,8 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<td style="padding:2px">{{wallet.persons}}</td>
|
||||
<td style="padding:2px">
|
||||
{% if wallet.cave %}
|
||||
{% if wallet.cave.slug %}
|
||||
<a href="/cave/scans/{{wallet.cave.slug}}">{{wallet.cave}}</a>
|
||||
{% if wallet.caveobj.slug %}
|
||||
<a href="/cave/scans/{{wallet.caveobj.slug}}">{{wallet.cave}}</a>
|
||||
{% else %}
|
||||
{{wallet.cave}}
|
||||
{% endif %}
|
||||
|
@ -24,12 +24,13 @@
|
||||
<td style="padding:2px">{% if wallet.date %}{{wallet.date}}{% else %} {% endif %}</td>
|
||||
<td style="padding:2px">
|
||||
{% if wallet.cave %}
|
||||
{% if wallet.cave.slug %}
|
||||
<a href="/cave/scans/{{wallet.cave.slug}}">{{wallet.cave}}</a>
|
||||
{% if wallet.caveobj.slug %}
|
||||
<a href="/cave/scans/{{wallet.caveobj.slug}}">{{wallet.cave}}</a>
|
||||
{% else %}
|
||||
{{wallet.cave}}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<em>No wallet.cave {{wallet.cave}}</em>
|
||||
{% endif %}</td>
|
||||
<td style="padding:2px">{% if wallet.name %}{{wallet.name}}{% else %}<em>{% if wallet.displaynames %} {% for dn in wallet.displaynames %}{{dn}}{%if not forloop.last %}, {% endif %} {% endfor %}{% else %} {% endif %}</em>{% endif %}</td>
|
||||
<td style="padding:2px" align=center>
|
||||
|
@ -40,8 +40,8 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<td style="padding:2px">{{wallet.persons}}</td>
|
||||
<td style="padding:2px">
|
||||
{% if wallet.cave %}
|
||||
{% if wallet.cave.slug %}
|
||||
<a href="/cave/scans/{{wallet.cave.slug}}">{{wallet.cave}}</a>
|
||||
{% if wallet.caveobj.slug %}
|
||||
<a href="/cave/scans/{{wallet.caveobj.slug}}">{{wallet.cave}}</a>
|
||||
{% else %}
|
||||
{{wallet.cave}}
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user