Fix situation in which deleting a fit that was both a command and projected fit for the same target threw an error

This commit is contained in:
blitzmann
2017-05-12 21:47:47 -04:00
parent c68739d78c
commit 5e20d6973f

View File

@@ -173,13 +173,22 @@ class Fit(object):
# refresh any fits this fit is projected onto. Otherwise, if we have
# already loaded those fits, they will not reflect the changes
# A note on refreshFits: we collect the target fits in a set because
# if a target fit has the same fit for both projected and command,
# it will be refreshed first during the projected loop and throw an
# error during the command loop
refreshFits = set()
for projection in fit.projectedOnto.values():
if projection.victim_fit in eos.db.saveddata_session: # GH issue #359
eos.db.saveddata_session.refresh(projection.victim_fit)
refreshFits.add(projection.victim_fit)
for booster in fit.boostedOnto.values():
if booster.boosted_fit in eos.db.saveddata_session: # GH issue #359
eos.db.saveddata_session.refresh(booster.boosted_fit)
refreshFits.add(booster.boosted_fit)
for fit in refreshFits:
eos.db.saveddata_session.refresh(fit)
@staticmethod
def copyFit(fitID):