From 86ee5292d887e21164203b550b5783f9575b3b0c Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 11 Jul 2015 11:19:10 -0400 Subject: [PATCH] Fix fit copying and deleting fits not being reflected in other fits. --- eos/saveddata/fit.py | 8 +++++--- service/fit.py | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 3048b1702..a58946009 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -210,11 +210,10 @@ class Fit(object): @property def projectedFits(self): # only in extreme edge cases will the fit be invalid, but to be sure do - # not return them. By this time + # not return them. return [fit for fit in self.__projectedFits.values() if not fit.isInvalid] def getProjectionInfo(self, fitID): - print "get projection info for fitID: ", fitID return self.projectedOnto.get(fitID, None) @property @@ -967,6 +966,9 @@ class Fit(object): c.append(deepcopy(i, memo)) for fit in self.projectedFits: - copy.projectedFits.append(fit) + copy.__projectedFits[fit.ID] = fit + # this bit is required -- see GH issue # 83 + eos.db.saveddata_session.flush() + eos.db.saveddata_session.refresh(fit) return copy diff --git a/service/fit.py b/service/fit.py index ebb7024a8..40cbe8eb0 100644 --- a/service/fit.py +++ b/service/fit.py @@ -178,6 +178,11 @@ class Fit(object): eos.db.remove(fit) + # refresh any fits this fit is projected onto. Otherwise, if we have + # already loaded those fits, they will not reflect the changes + for projection in fit.projectedOnto.values(): + eos.db.saveddata_session.refresh(projection.victim_fit) + def copyFit(self, fitID): fit = eos.db.getFit(fitID) newFit = copy.deepcopy(fit)