mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Better debug messages
This commit is contained in:
parent
d0a05af9c6
commit
b428a87f1a
@ -153,11 +153,11 @@ class SurvexBlock(models.Model):
|
||||
class Meta:
|
||||
ordering = ("id",)
|
||||
|
||||
def __str__(self):
|
||||
return "[SurvexBlock:" + str(self.name) + "-path:" + str(self.survexpath) + "-cave:" + str(self.cave) + "]"
|
||||
# def __str__(self):
|
||||
# return "[SurvexBlock:" + str(self.name) + "-path:" + str(self.survexpath) + "-cave:" + str(self.cave) + "]"
|
||||
|
||||
def __str__(self):
|
||||
return self.name and str(self.name) or "no name"
|
||||
return self.name and str(self.name) or "no_name-#" + str(self.id)
|
||||
|
||||
def isSurvexBlock(self): # Function used in templates
|
||||
return True
|
||||
|
@ -392,17 +392,33 @@ class LoadingSurvex:
|
||||
# Bolluxed up if we try to inherit from this random junk, so don't.
|
||||
return
|
||||
|
||||
if not self.currentdate:
|
||||
if self.inheritdate:
|
||||
message = (
|
||||
f"- INHERITING ({survexblock.parent})>({survexblock}) {survexblock.survexfile.path} '{self.inheritdate:%Y-%m-%d}'"
|
||||
)
|
||||
print(self.insp + message)
|
||||
stash_data_issue(
|
||||
parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
)
|
||||
survexblock.date = self.inheritdate
|
||||
return self.inheritdate
|
||||
if self.currentdate:
|
||||
# already set
|
||||
return
|
||||
|
||||
if self.inheritdate:
|
||||
# Not an error, so not put in DataIssues, but is printed to debug output
|
||||
message = (
|
||||
f"- No *date. INHERITING date from ({survexblock})-{survexblock.survexfile.path} to ({survexblock.parent}) to {self.inheritdate:%Y-%m-%d}"
|
||||
)
|
||||
print(self.insp + message)
|
||||
# stash_data_issue(
|
||||
# parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
# )
|
||||
survexblock.date = self.inheritdate
|
||||
self.currentdate = self.inheritdate # unecessary duplication
|
||||
return self.inheritdate
|
||||
else:
|
||||
# This is not an error in the Expo dataset.
|
||||
# Many files just holding *include lines do not have dates.
|
||||
# Hardly _any_ of the ARGE survex files have dates !
|
||||
pass
|
||||
# message = f" ! No survexblock.date inheritable in '{survexblock}' in '{survexblock.survexfile.path}', setting to 1976"
|
||||
# print(self.insp + message)
|
||||
# stash_data_issue(
|
||||
# parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
# )
|
||||
# expoyear = "1976"
|
||||
return
|
||||
|
||||
def fix_anonymous(self, survexblock):
|
||||
@ -1300,15 +1316,10 @@ class LoadingSurvex:
|
||||
survexblock.survexfile.cave.slug()
|
||||
else:
|
||||
pass
|
||||
if survexblock.date:
|
||||
expoyear = str(survexblock.date.year)
|
||||
else:
|
||||
message = f" ! No survexblock.date in {survexblock} in '{survexblock.survexfile.path}', setting to 1976"
|
||||
print(insp + message)
|
||||
stash_data_issue(
|
||||
parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
)
|
||||
expoyear = "1976"
|
||||
|
||||
self.fix_undated(survexblock) # null-op if already set
|
||||
expoyear = str(survexblock.date.year)
|
||||
|
||||
try:
|
||||
qm = QM.objects.create(
|
||||
number=qm_no,
|
||||
@ -1336,8 +1347,7 @@ class LoadingSurvex:
|
||||
expoyear=expoyear,
|
||||
cave=survexblock.survexfile.cave,
|
||||
)
|
||||
print(qms)
|
||||
message = f" ! QM{qm_no} FAIL to create {qm_nearest} in'{survexblock.survexfile.path}'"
|
||||
message = f" ! QM{qm_no} FAIL to create {qm_nearest} in'{survexblock.survexfile.path}' found {len(qms)}:{qms}"
|
||||
print(insp + message)
|
||||
stash_data_issue(
|
||||
parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
|
Loading…
Reference in New Issue
Block a user