Skip to content

Commit

Permalink
Merge pull request pyfa-org#99 from Pyfa-fit/catchup_bugfixes
Browse files Browse the repository at this point in the history
Catchup: Bugfixes
  • Loading branch information
Ebag333 authored May 21, 2017
2 parents 181fb37 + e828eb4 commit c1542a3
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 29 deletions.
44 changes: 24 additions & 20 deletions eos/db/migrations/upgrade17.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@ def upgrade(saveddata_engine):
JOIN wings w on w.ID = s.wingID
JOIN gangs g on g.ID = w.gangID
"""

results = saveddata_session.execute(sql)

inserts = []

for row in results:
boosted = row["boostedFit"]
types = ("squad", "wing", "gang")
for x in types:
value = row["{}Boost".format(x)]
if value is None:
continue

inserts.append({"boosterID": value, "boostedID": boosted, "active": 1})
try:
saveddata_session.execute(commandFits_table.insert(),
{"boosterID": value, "boostedID": boosted, "active": 1})
except Exception:
pass
saveddata_session.commit()
try:
results = saveddata_session.execute(sql)

inserts = []

for row in results:
boosted = row["boostedFit"]
types = ("squad", "wing", "gang")
for x in types:
value = row["{}Boost".format(x)]
if value is None:
continue

inserts.append({"boosterID": value, "boostedID": boosted, "active": 1})
try:
saveddata_session.execute(commandFits_table.insert(),
{"boosterID": value, "boostedID": boosted, "active": 1})
except Exception:
pass
saveddata_session.commit()
except:
# Shouldn't fail unless you have updated database without the old fleet schema and manually modify the database version
# If it does, simply fail. Fleet data migration isn't critically important here
pass
12 changes: 9 additions & 3 deletions eos/db/migrations/upgrade6.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@


def upgrade(saveddata_engine):
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1"))
saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?)',
(1, "Uniform", 25, 25, 25, 25, None))
try:
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1"))
saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?)',
(1, "Uniform", 25, 25, 25, 25, None))
except:
# Most likely using the newer DB schema (migration 22). Go ahead and account for that.
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1"))
saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
(1, "Uniform", 25, 25, 25, 25, None, None, None))
2 changes: 1 addition & 1 deletion gui/builtinStatsViews/priceViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def refreshPanelPrices(self, fit=None):

if fit.fighters:
for fighter in fit.fighters:
fighter_price += fighter.item.price.price * fighter.amount
fighter_price += fighter.item.price.price * fighter.amountActive

if fit.cargo:
for cargo in fit.cargo:
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinStatsViews/priceViewMinimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def refreshPanelPrices(self, fit=None):

if fit.fighters:
for fighter in fit.fighters:
fighter_price += fighter.item.price.price * fighter.amount
fighter_price += fighter.item.price.price * fighter.amountActive

if fit.cargo:
for cargo in fit.cargo:
Expand Down
6 changes: 4 additions & 2 deletions gui/commandView.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,7 @@ def remove(self, event):
if col != self.getColIndex(State):
fitID = self.mainFrame.getActiveFit()
sFit = Fit.getInstance()
sFit.removeCommand(fitID, self.get(row))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
thing = self.get(row)
if thing: # thing doesn't exist if it's the dummy value
sFit.removeCommand(fitID, thing)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
6 changes: 4 additions & 2 deletions gui/projectedView.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,5 +298,7 @@ def remove(self, event):
if col != self.getColIndex(State):
fitID = self.mainFrame.getActiveFit()
sFit = Fit.getInstance()
sFit.removeProjected(fitID, self.get(row))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
thing = self.get(row)
if thing: # thing doesn't exist if it's the dummy value
sFit.removeProjected(fitID, thing)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))

0 comments on commit c1542a3

Please sign in to comment.