Fix importing damage profiles which included overwriting existing ones and then performing a delete on one of them. #1416

This commit is contained in:
blitzmann
2018-02-24 01:49:09 -05:00
parent 362086cc83
commit f442632fbc
2 changed files with 24 additions and 16 deletions

View File

@@ -72,21 +72,9 @@ class DamagePattern(object):
eos.db.save(p)
def importPatterns(self, text):
lookup = {}
current = self.getDamagePatternList()
for pattern in current:
lookup[pattern.name] = pattern
imports, num = es_DamagePattern.importPatterns(text)
for pattern in imports:
if pattern.name in lookup:
match = lookup[pattern.name]
match.__dict__.update(pattern.__dict__)
else:
eos.db.save(pattern)
eos.db.commit()
lenImports = len(imports)
if lenImports == 0:
raise ImportError("No patterns found for import")
if lenImports != num: