Ensure that module-fit relationship is established before running some checks which can rely on them
This commit is contained in:
@@ -54,6 +54,9 @@ class CalcAddLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
return False
|
||||
self.savedPosition = fit.modules.index(newMod)
|
||||
# Need to flush because checkStates sometimes relies on module->fit
|
||||
# relationship via .owner attribute, which is handled by SQLAlchemy
|
||||
eos.db.flush()
|
||||
sFit.recalc(fit)
|
||||
self.savedStateCheckChanges = sFit.checkStates(fit, newMod)
|
||||
if self.commit:
|
||||
|
||||
@@ -46,6 +46,9 @@ class CalcChangeLocalModuleStatesCommand(wx.Command):
|
||||
mod.state = proposedState
|
||||
if not changed:
|
||||
return False
|
||||
# Need to flush because checkStates sometimes relies on module->fit
|
||||
# relationship via .owner attribute, which is handled by SQLAlchemy
|
||||
eos.db.flush()
|
||||
sFit.recalc(fit)
|
||||
self.savedStateCheckChanges = sFit.checkStates(fit, mainMod)
|
||||
eos.db.commit()
|
||||
|
||||
@@ -37,6 +37,9 @@ class CalcCloneLocalModuleCommand(wx.Command):
|
||||
pyfalog.warning('Failed to replace module')
|
||||
eos.db.commit()
|
||||
return False
|
||||
# Need to flush because checkStates sometimes relies on module->fit
|
||||
# relationship via .owner attribute, which is handled by SQLAlchemy
|
||||
eos.db.flush()
|
||||
sFit.recalc(fit)
|
||||
self.savedStateCheckChanges = sFit.checkStates(fit, copyMod)
|
||||
eos.db.commit()
|
||||
|
||||
@@ -30,6 +30,9 @@ class CalcRemoveLocalModulesCommand(wx.Command):
|
||||
self.savedModInfos[position] = ModuleInfo.fromModule(mod)
|
||||
fit.modules.free(position)
|
||||
|
||||
# Need to flush because checkStates sometimes relies on module->fit
|
||||
# relationship via .owner attribute, which is handled by SQLAlchemy
|
||||
eos.db.flush()
|
||||
sFit.recalc(fit)
|
||||
self.savedStateCheckChanges = sFit.checkStates(fit, None)
|
||||
if self.commit:
|
||||
|
||||
@@ -56,6 +56,9 @@ class CalcReplaceLocalModuleCommand(wx.Command):
|
||||
pyfalog.warning('Failed to replace in list')
|
||||
self.Undo()
|
||||
return False
|
||||
# Need to flush because checkStates sometimes relies on module->fit
|
||||
# relationship via .owner attribute, which is handled by SQLAlchemy
|
||||
eos.db.flush()
|
||||
sFit.recalc(fit)
|
||||
self.savedStateCheckChanges = sFit.checkStates(fit, newMod)
|
||||
if self.commit:
|
||||
|
||||
Reference in New Issue
Block a user