Add active column. Looping the fit to apply it x amount of times doesn't seem to work. Probably because it's been flagged calculated and returns early

This commit is contained in:
blitzmann
2015-07-07 00:25:24 -04:00
parent 2bca3ddcc8
commit b95a10d284
5 changed files with 15 additions and 10 deletions

View File

@@ -46,14 +46,18 @@ fits_table = Table("fits", saveddata_meta,
projectedFits_table = Table("projectedFits", saveddata_meta,
Column("sourceID", ForeignKey("fits.ID"), primary_key = True),
Column("victimID", ForeignKey("fits.ID"), primary_key = True),
Column("amount", Integer))
Column("amount", Integer),
Column("active", Boolean),
)
class ProjectedFit(object):
def __init__(self, source_item, dest_item, enabled):
print "init projected item", source_item, dest_item, enabled
def __init__(self, source_item, dest_item, amount=1, active=True):
print "init projected item", source_item, dest_item, active, amount
self.source_item = source_item
self.dest_item = dest_item
self.amount = enabled
self.amount = amount
self.active = active
self.dest_item.projectionInfo = self
@reconstructor
def init(self):
@@ -65,7 +69,7 @@ class ProjectedFit(object):
Fit._Fit__projectedFits = association_proxy(
"projected_items",
"dest_item",
creator=lambda dest_item: ProjectedFit(None, dest_item, True)
creator=lambda dest_item: ProjectedFit(None, dest_item)
)
mapper(Fit, fits_table,

View File

@@ -461,8 +461,9 @@ class Fit(object):
item.calculateModifiedAttributes(targetFit, runTime, True)
for fit in self.projectedFits:
if fit.projectionInfo.amount > 0:
fit.calculateModifiedAttributes(self, withBoosters=withBoosters, dirtyStorage=dirtyStorage)
if fit.projectionInfo.active:
#for _ in xrange(fit.projectionInfo.amount):
fit.calculateModifiedAttributes(self, withBoosters=withBoosters, dirtyStorage=dirtyStorage)
def fill(self):
"""

View File

@@ -39,7 +39,7 @@ class BaseName(ViewColumn):
elif isinstance(stuff, Cargo):
return "%dx %s" % (stuff.amount, stuff.item.name)
elif isinstance(stuff, Fit):
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
return "%dx %s (%s)" % (stuff.projectionInfo.amount, stuff.name, stuff.ship.item.name)
elif isinstance(stuff, Rack):
if service.Fit.getInstance().serviceFittingOptions["rackLabels"]:
if stuff.slot == Slot.MODE:

View File

@@ -67,7 +67,7 @@ class State(ViewColumn):
elif isinstance(stuff, Fit):
if stuff.projectionInfo is None:
return -1
if stuff.projectionInfo.amount > 0:
if stuff.projectionInfo.active:
return generic_active
return generic_inactive
else:

View File

@@ -365,7 +365,7 @@ class Fit(object):
thing.state = State.OFFLINE
elif isinstance(thing, eos.types.Fit):
print "toggle fit"
thing.projectionInfo.amount = not thing.projectionInfo.amount
thing.projectionInfo.active = not thing.projectionInfo.active
eos.db.commit()
self.recalc(fit)