| 202 | |
| 203 | @staticmethod |
| 204 | def deleteFit(fitID): |
| 205 | fit = eos.db.getFit(fitID) |
| 206 | pyfalog.debug("Fit::deleteFit - Deleting fit: {}", fit) |
| 207 | |
| 208 | # refresh any fits this fit is projected onto. Otherwise, if we have |
| 209 | # already loaded those fits, they will not reflect the changes |
| 210 | |
| 211 | # A note on refreshFits: we collect the target fits in a set because |
| 212 | # if a target fit has the same fit for both projected and command, |
| 213 | # it will be refreshed first during the projected loop and throw an |
| 214 | # error during the command loop |
| 215 | refreshFits = set() |
| 216 | for projection in list(fit.projectedOnto.values()): |
| 217 | if projection.victim_fit and projection.victim_fit != fit and projection.victim_fit in eos.db.saveddata_session: # GH issue #359 |
| 218 | refreshFits.add(projection.victim_fit) |
| 219 | |
| 220 | for booster in list(fit.boostedOnto.values()): |
| 221 | if booster.boosted_fit and booster.boosted_fit != fit and booster.boosted_fit in eos.db.saveddata_session: # GH issue #359 |
| 222 | refreshFits.add(booster.boosted_fit) |
| 223 | |
| 224 | eos.db.remove(fit) |
| 225 | |
| 226 | if fitID in Fit.processors: |
| 227 | del Fit.processors[fitID] |
| 228 | |
| 229 | pyfalog.debug(" Need to refresh {} fits: {}", len(refreshFits), refreshFits) |
| 230 | for fit in refreshFits: |
| 231 | eos.db.saveddata_session.refresh(fit) |
| 232 | |
| 233 | eos.db.saveddata_session.commit() |
| 234 | |
| 235 | @classmethod |
| 236 | def getCommandProcessor(cls, fitID): |