forked from expo/troggle
import fixes & statistics table
This commit is contained in:
@@ -30,6 +30,7 @@ def readentrance(filename):
|
||||
with open(os.path.join(settings.ENTRANCEDESCRIPTIONS, filename)) as f:
|
||||
contents = f.read()
|
||||
context = "in file %s" % filename
|
||||
#print("Reading file ENTRANCE {} / {}".format(settings.ENTRANCEDESCRIPTIONS, filename))
|
||||
entrancecontentslist = getXML(contents, "entrance", maxItems = 1, context = context)
|
||||
if len(entrancecontentslist) == 1:
|
||||
entrancecontents = entrancecontentslist[0]
|
||||
@@ -83,10 +84,26 @@ def readentrance(filename):
|
||||
cached_primary_slug = slugs[0])
|
||||
primary = True
|
||||
for slug in slugs:
|
||||
#print slug, filename
|
||||
cs = models_caves.EntranceSlug.objects.update_or_create(entrance = e,
|
||||
slug = slug,
|
||||
primary = primary)
|
||||
#print("entrance slug:{} filename:{}".format(slug, filename))
|
||||
try:
|
||||
cs = models_caves.EntranceSlug.objects.update_or_create(entrance = e,
|
||||
slug = slug,
|
||||
primary = primary)
|
||||
except:
|
||||
# need to cope with duplicates
|
||||
print(" ! FAILED to get only one ENTRANCE when updating using: "+filename)
|
||||
kents = models_caves.EntranceSlug.objects.all().filter(entrance = e,
|
||||
slug = slug,
|
||||
primary = primary)
|
||||
for k in kents:
|
||||
message = " ! - DUPLICATE in db. entrance:"+ str(k.entrance) + ", slug:" + str(k.slug())
|
||||
models.DataIssue.objects.create(parser='caves', message=message)
|
||||
print(message)
|
||||
for k in kaves:
|
||||
if k.slug() != None:
|
||||
print(" ! - OVERWRITING this one: slug:"+ str(k.slug()))
|
||||
k.notes = "DUPLICATE entrance found on import. Please fix\n" + k.notes
|
||||
c = k
|
||||
primary = False
|
||||
|
||||
def readcave(filename):
|
||||
@@ -94,7 +111,7 @@ def readcave(filename):
|
||||
with open(os.path.join(settings.CAVEDESCRIPTIONS, filename)) as f:
|
||||
contents = f.read()
|
||||
context = " in file %s" % filename
|
||||
#print "Reading file %s" % filename
|
||||
#print("Reading file CAVE {}".format(filename))
|
||||
cavecontentslist = getXML(contents, "cave", maxItems = 1, context = context)
|
||||
#print cavecontentslist
|
||||
if len(cavecontentslist) == 1:
|
||||
@@ -145,7 +162,7 @@ def readcave(filename):
|
||||
filename = filename)
|
||||
except:
|
||||
# need to cope with duplicates
|
||||
print(" ! FAILED to get only one cave when updating using: "+filename)
|
||||
print(" ! FAILED to get only one CAVE when updating using: "+filename)
|
||||
kaves = models_caves.Cave.objects.all().filter(kataster_number=kataster_number[0])
|
||||
for k in kaves:
|
||||
message = " ! - DUPLICATES in db. kataster:"+ str(k.kataster_number) + ", slug:" + str(k.slug())
|
||||
|
||||
Reference in New Issue
Block a user