From 3b91ec8c06ca8bdf494db078819d96d631cd8ef6 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 21:24:24 -0800 Subject: [PATCH] Move check for module state being valid out of effectHandlerHelpers and into service\fit. We can't have it there because of cyclical imports. Plus we're already checking the module state here, so makes lots of sense to merge them. --- eos/effectHandlerHelpers.py | 7 ------- service/fit.py | 8 ++++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index f4854d577..daa68c5c4 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -136,13 +136,6 @@ class HandledModuleList(HandledList): self.remove(mod) return - # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module - # TODO: This can't point to es_module, cyclical import loop - ''' - if not mod.isValidState(mod.state): - mod.state = es_State.ONLINE - ''' - def insert(self, index, mod): mod.position = index i = index diff --git a/service/fit.py b/service/fit.py index 5f92bd949..6f6943d37 100644 --- a/service/fit.py +++ b/service/fit.py @@ -905,13 +905,17 @@ class Fit(object): changed = False for mod in fit.modules: if mod != base: - if not mod.canHaveState(mod.state): + # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module + if not mod.canHaveState(mod.state) or not mod.isValidState(mod.state): mod.state = State.ONLINE changed = True + for mod in fit.projectedModules: - if not mod.canHaveState(mod.state, fit): + # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module + if not mod.canHaveState(mod.state, fit) or not mod.isValidState(mod.state): mod.state = State.OFFLINE changed = True + for drone in fit.projectedDrones: if drone.amountActive > 0 and not drone.canBeApplied(fit): drone.amountActive = 0