Skip to content

Commit

Permalink
fixed a bug (hopefully?) in Validate Database
Browse files Browse the repository at this point in the history
  • Loading branch information
ethoms-usgs committed Feb 16, 2021
1 parent 910d769 commit 2ff9fbc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Scripts/GeMS_ValidateDatabase_AGP2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Added feature dataset SRF names to database inventory - RH

import arcpy, os, os.path, sys, time, glob
import copy
from arcpy import metadata as md
from GeMS_utilityFunctions import *
from GeMS_Definition import *
Expand Down Expand Up @@ -523,11 +524,13 @@ def ScanTable from CSAMapUnitPolys as the table to which it should be compared.
# build dictionary of required fields
requiredFields = {}
optionalFields = {}
requiredFieldDefs = tableDict[table]
requiredFieldDefs = copy.deepcopy(tableDict[def_table])
arcpy.AddMessage(f'requireFieldDefs {requiredFieldDefs}')
if compare_table:
# update the definition of the _ID field to include a 'CSX' prefix
prefix = compare_table[:3]
id_item = [n for n in requiredFieldDefs if n[0] == def_table + '_ID']
arcpy.AddMessage(f'id_item {id_item}')
new_id = prefix + id_item[0][0]
i = requiredFieldDefs.index(id_item[0])
requiredFieldDefs[i][0] = new_id
Expand Down Expand Up @@ -563,6 +566,8 @@ def ScanTable from CSAMapUnitPolys as the table to which it should be compared.
except:
schemaErrorsMissingFields.append('<span class="table">'+compare_table+
'</span> could not get field list. Fields not checked.')

del requiredFieldDefs

def notEmpty(x):
# will fail on not-String values of x
Expand Down Expand Up @@ -610,7 +615,7 @@ def scanTable(table, fds=None):
isExtension = False
fieldDefs = tableDict[table]
checkFieldDefinitions(table)
elif fds[:12] == 'CrossSection' and table[:3] == 'CS'+fds[12] and tableDict.has_key(table[3:]):
elif fds[:12] == 'CrossSection' and table[:3] == 'CS'+fds[12] and table[3:] in tableDict:
isExtension = False
fieldDefs = tableDict[table[3:]]
checkFieldDefinitions(table[3:], table)
Expand Down

0 comments on commit 2ff9fbc

Please sign in to comment.