diff options
Diffstat (limited to 'parsers/locations.py')
-rw-r--r-- | parsers/locations.py | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/parsers/locations.py b/parsers/locations.py index 8a5da4f..acf41b9 100644 --- a/parsers/locations.py +++ b/parsers/locations.py @@ -34,7 +34,7 @@ class MapLocations(object): We don't need these map locations any more ?! They would only be used in addition to entrances going onto a map display""" - p = [ + fp = [ ("laser.0_7", "BNase", "Reference", "Bräuning Nase laser point"), ("226-96", "BZkn", "Reference", "Bräuning Zinken trig point"), ("vd1", "VD1", "Reference", "VD1 survey point"), @@ -48,13 +48,15 @@ class MapLocations(object): ("laser.0_5", "LSR5", "Reference", "Laser Point 0/5"), ("225-96", "BAlm", "Reference", "Bräuning Alm trig point"), ] # 12 fixed points + + p = [] def points(self): prior = len(self.p) for ent in Entrance.objects.all(): for st, ent_type in {ent.exact_station: "exact", ent.other_station: "other", ent.tag_station: "tag"}.items(): if st != "": - self.p.append((st, str(ent), ent.needs_surface_work(), str(ent))) + self.p.append((st, str(ent), ent.needs_surface_work(), ent)) store_data_issues() found = len(self.p) - prior message = f" - {found} Entrance tags found - not yet validated against survex .pos file." @@ -70,9 +72,10 @@ def validate_entrance_stations(ent=None): """ bads = 0 good = 0 + url="/caves" # fallback def tag_lower_case(station): - + nonlocal url so = SurvexStation.objects.filter(name=station.lower()) if so.count() == 1: message = f"X - Entrance {ent} station '{station}' should be '{station.lower()}'" @@ -104,29 +107,31 @@ def validate_entrance_stations(ent=None): continue try: so = SurvexStation.objects.filter(name=st) - if so.count() == 1: - good +=1 - # print(f"OK - Entrance {ent} '{ent_type}' station '{st}'") - continue - if so.count() != 0: - message =f"{so.count()} found for Entrance {ent} '{ent_type}' station '{st}' {so}" - else: - message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'" - if st == ent.best_station(): - message = message + " - AND THIS IS THE 'BEST' ONE" - else: - message = message + " - not the 'best'" - stash_data_issue(parser="positions", message=message, url=url) - print(message) - bads +=1 - tag_lower_case(st) - continue except: message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'. EXCEPTION." stash_data_issue(parser="positions", message=message, url=url) print(message) bads +=1 continue + + if so.count() == 1: + good +=1 + # print(f"OK - Entrance {ent} '{ent_type}' station '{st}'") + continue + if so.count() != 0: + message =f"{so.count()} found for Entrance {ent} '{ent_type}' station '{st}' {so}" + else: + message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'" + if st == ent.best_station(): + message = message + " - AND THIS IS THE 'BEST' ONE" + else: + message = message + " - not the 'best'" + stash_data_issue(parser="positions", message=message, url=url) + print(message) + bads +=1 + tag_lower_case(st) + continue + if ent: return validate_ent(ent) @@ -255,8 +260,10 @@ def LoadPositions(): mappoints = {} for pt in MapLocations().points(): - svxid, number, point_type, label = pt - mappoints[svxid] = True + svxid, number, point_type, ent = pt + #((st, str(ent), ent.needs_surface_work(), ent)) + + mappoints[svxid] = ent if svxid =="1": print(f"BOGUS {pt}") # this is now checked for when importing the entrance tags in parsers/caves.py @@ -294,6 +301,7 @@ def LoadPositions(): ss.x = float(x) ss.y = float(y) ss.z = float(z) + ss.entrance = mappoints[sid] ss.save() found += 1 except: |