mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 10:37:12 +00:00
fix missing slug field in pending caves
This commit is contained in:
@@ -24,13 +24,14 @@ def readcaves():
|
|||||||
|
|
||||||
print (" - Setting pending caves")
|
print (" - Setting pending caves")
|
||||||
# Do this first, so that these empty entries are overwritten as they get properly created.
|
# Do this first, so that these empty entries are overwritten as they get properly created.
|
||||||
|
|
||||||
# For those caves which do not have XML files even though they exist and have surveys
|
# For those caves which do not have XML files even though they exist and have surveys
|
||||||
# also needs to be done *before* entrances so that the entrance-cave links work properly.
|
# also needs to be done *before* entrances so that the entrance-cave links work properly.
|
||||||
forgotten = ["2007-04", "2007-05", "2007-06", "2007-07", "2007-12", "2009-01", "2009-02",
|
pending = ["2007-04", "2007-05", "2007-06", "2007-07", "2007-12", "2009-01", "2009-02",
|
||||||
"2010-06", "2010-07", "2012-ns-01", "2012-ns-02", "2010-04", "2012-ns-05", "2012-ns-06",
|
"2010-06", "2010-07", "2012-ns-01", "2012-ns-02", "2010-04", "2012-ns-05", "2012-ns-06",
|
||||||
"2012-ns-07", "2012-ns-08", "2012-ns-12", "2012-ns-14", "2012-ns-15", "2014-bl888",
|
"2012-ns-07", "2012-ns-08", "2012-ns-12", "2012-ns-14", "2012-ns-15", "2014-bl888",
|
||||||
"2018-pf-01", "2018-pf-02", "haldenloch", "gruenstein"]
|
"2018-pf-01", "2018-pf-02", "haldenloch", "gruenstein"]
|
||||||
for k in forgotten:
|
for k in pending:
|
||||||
try:
|
try:
|
||||||
cave = models_caves.Cave(
|
cave = models_caves.Cave(
|
||||||
unofficial_number = k,
|
unofficial_number = k,
|
||||||
@@ -44,8 +45,19 @@ def readcaves():
|
|||||||
message = " ! {:11s} {}".format(cave.unofficial_number, cave.underground_description)
|
message = " ! {:11s} {}".format(cave.unofficial_number, cave.underground_description)
|
||||||
DataIssue.objects.create(parser='caves', message=message)
|
DataIssue.objects.create(parser='caves', message=message)
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
|
try: # Now create a slug ID
|
||||||
|
cs = models_caves.CaveSlug.objects.update_or_create(cave = cave,
|
||||||
|
slug = "PENDING-" + k,
|
||||||
|
primary = False)
|
||||||
|
except:
|
||||||
|
message = " ! {:11s} {} PENDING cave slug create failure".format(k)
|
||||||
|
DataIssue.objects.create(parser='caves', message=message)
|
||||||
|
print(message)
|
||||||
else:
|
else:
|
||||||
print("Failed to create cave {} ".format(k))
|
print("Failed to create cave {} ".format(k))
|
||||||
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
message = " ! Error. Cannot create pending cave, pending-id:{}".format(k)
|
message = " ! Error. Cannot create pending cave, pending-id:{}".format(k)
|
||||||
DataIssue.objects.create(parser='caves', message=message)
|
DataIssue.objects.create(parser='caves', message=message)
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import os
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import copy
|
import copy
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from subprocess import call, run
|
|
||||||
|
|
||||||
from django.utils.timezone import get_current_timezone
|
from django.utils.timezone import get_current_timezone
|
||||||
from django.utils.timezone import make_aware
|
from django.utils.timezone import make_aware
|
||||||
@@ -1076,7 +1076,7 @@ class LoadingSurvex():
|
|||||||
def runcavern():
|
def runcavern():
|
||||||
print(" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{}'\n days svx old: {:.1f} cav:{:.1f} log old: {:.1f}".
|
print(" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{}'\n days svx old: {:.1f} cav:{:.1f} log old: {:.1f}".
|
||||||
format(fullpath, (svx_t - log_t)/(24*3600), (cav_t - log_t)/(24*3600), (now - log_t)/(24*3600)))
|
format(fullpath, (svx_t - log_t)/(24*3600), (cav_t - log_t)/(24*3600), (now - log_t)/(24*3600)))
|
||||||
call([settings.CAVERN, "--log", "--output={}".format(fullpath), "{}.svx".format(fullpath)])
|
subprocess.call([settings.CAVERN, "--log", "--output={}".format(settings.THREEDCACHEDIR), "{}.svx".format(fullpath)])
|
||||||
|
|
||||||
svxpath = fullpath + ".svx"
|
svxpath = fullpath + ".svx"
|
||||||
logpath = fullpath + ".log"
|
logpath = fullpath + ".log"
|
||||||
@@ -1086,7 +1086,7 @@ class LoadingSurvex():
|
|||||||
return
|
return
|
||||||
|
|
||||||
if not self.caverndate:
|
if not self.caverndate:
|
||||||
completed_process = run(["which", "{}".format(settings.CAVERN)],
|
completed_process = subprocess.run(["which", "{}".format(settings.CAVERN)],
|
||||||
capture_output=True, check=True, text=True)
|
capture_output=True, check=True, text=True)
|
||||||
self.caverndate = os.path.getmtime(completed_process.stdout.strip())
|
self.caverndate = os.path.getmtime(completed_process.stdout.strip())
|
||||||
cav_t = self.caverndate
|
cav_t = self.caverndate
|
||||||
@@ -1252,10 +1252,10 @@ def LoadPositions():
|
|||||||
def runcavern3d():
|
def runcavern3d():
|
||||||
print(" - Regenerating stale cavern .log and .3d for '{}'\n days old: {:.1f} {:.1f} {:.1f}".
|
print(" - Regenerating stale cavern .log and .3d for '{}'\n days old: {:.1f} {:.1f} {:.1f}".
|
||||||
format(topdata, (svx_t - d3d_t)/(24*3600), (cav_t - d3d_t)/(24*3600), (now - d3d_t)/(24*3600)))
|
format(topdata, (svx_t - d3d_t)/(24*3600), (cav_t - d3d_t)/(24*3600), (now - d3d_t)/(24*3600)))
|
||||||
call([settings.CAVERN, "--log", "--output={}".format(topdata), "{}.svx".format(topdata)])
|
subprocess.call([settings.CAVERN, "--log", "--output={}".format(topdata), "{}.svx".format(topdata)])
|
||||||
|
|
||||||
print(" - Regenerating {} {}.3d in {}".format(settings.SURVEXPORT, topdata, settings.SURVEX_DATA))
|
print(" - Regenerating {} {}.3d in {}".format(settings.SURVEXPORT, topdata, settings.SURVEX_DATA))
|
||||||
call([settings.SURVEXPORT, '--pos', '{}.3d'.format(topdata)], cwd = settings.SURVEX_DATA)
|
subprocess.call([settings.SURVEXPORT, '--pos', '{}.3d'.format(topdata)], cwd = settings.SURVEX_DATA)
|
||||||
|
|
||||||
topdata = os.fspath(Path(settings.SURVEX_DATA) / settings.SURVEX_TOPNAME)
|
topdata = os.fspath(Path(settings.SURVEX_DATA) / settings.SURVEX_TOPNAME)
|
||||||
print((' - Generating a list of Pos from %s.svx and then loading...' % (topdata)))
|
print((' - Generating a list of Pos from %s.svx and then loading...' % (topdata)))
|
||||||
@@ -1265,7 +1265,7 @@ def LoadPositions():
|
|||||||
print("\n") # extra line because cavern overwrites the text buffer somehow
|
print("\n") # extra line because cavern overwrites the text buffer somehow
|
||||||
# cavern defaults to using same cwd as supplied input file
|
# cavern defaults to using same cwd as supplied input file
|
||||||
|
|
||||||
completed_process = run(["which", "{}".format(settings.CAVERN)],
|
completed_process = subprocess.run(["which", "{}".format(settings.CAVERN)],
|
||||||
capture_output=True, check=True, text=True)
|
capture_output=True, check=True, text=True)
|
||||||
cav_t = os.path.getmtime(completed_process.stdout.strip())
|
cav_t = os.path.getmtime(completed_process.stdout.strip())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user