diff --git a/parsers/drawings.py b/parsers/drawings.py index 8c45aae..d0a2257 100644 --- a/parsers/drawings.py +++ b/parsers/drawings.py @@ -54,7 +54,10 @@ def find_dwg_file(dwgfile, path): scansfilel = wallet.singlescan_set.filter(name=mscansdir.group(2)) if len(scansfilel): if len(scansfilel) > 1: - message = "! More than one image FILENAME matches filter query. [{}]: {} {} {} {}".format(scansfilel[0], mscansdir.group(1), mscansdir.group(2), dwgfile.dwgpath, path) + plist =[] + for sf in scansfilel: + plist.append(sf.ffile) + message = "! More than one image FILENAME matches filter query. [{}]: {} {} {} {} {}".format(scansfilel[0], mscansdir.group(1), mscansdir.group(2), dwgfile.dwgpath, path, plist) print(message) DataIssue.objects.create(parser='Tunnel', message=message) scansfile = scansfilel[0] @@ -68,11 +71,15 @@ def find_dwg_file(dwgfile, path): name = os.path.split(path)[1] rdwgfilel = DrawingFile.objects.filter(dwgname=name) if len(rdwgfilel): - message = "! Two paths with same name [{}]: {}".format(path, name) - print(message) - DataIssue.objects.create(parser='Tunnel', message=message) - rdwgfile = rdwgfilel[0] - dwgfile.dwgcontains.add(rdwgfile) + if len(rdwgfilel) > 1: + plist =[] + for df in rdwgfilel: + plist.append(df.dwgname) + message = f"! {len(rdwgfilel)} paths found with same name '{path}' {plist}" + print(message) + DataIssue.objects.create(parser='Tunnel', message=message) + rdwgfile = rdwgfilel[0] + dwgfile.dwgcontains.add(rdwgfile) dwgfile.save()