From 5e20d6973f9992c45abce53e9640eeb1949e366f Mon Sep 17 00:00:00 2001 From: blitzmann Date: Fri, 12 May 2017 21:47:47 -0400 Subject: [PATCH] Fix situation in which deleting a fit that was both a command and projected fit for the same target threw an error --- service/fit.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/service/fit.py b/service/fit.py index ee173da92..a905c7767 100644 --- a/service/fit.py +++ b/service/fit.py @@ -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):