From 74c1ed6d8272b26193f2d74b613bd417dcffc242 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Thu, 18 May 2017 19:07:59 -0700 Subject: [PATCH 1/4] Check if projected / command thing actually exist before attempting to remove it (cherry picked from commit 00dcda6) --- gui/commandView.py | 6 ++++-- gui/projectedView.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/commandView.py b/gui/commandView.py index 6ba38859bb..2d8899dff8 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -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)) diff --git a/gui/projectedView.py b/gui/projectedView.py index 091c4a94dc..b971272b69 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -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)) From 568ffeaa8080ba410788eab75cb572d5a49dd40a Mon Sep 17 00:00:00 2001 From: blitzmann Date: Thu, 18 May 2017 19:22:45 -0700 Subject: [PATCH 2/4] Fix for fighter prices (#1178) (cherry picked from commit fbf455c) --- gui/builtinStatsViews/priceViewFull.py | 2 +- gui/builtinStatsViews/priceViewMinimal.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 0b7ea8df6a..7a91c8d045 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -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: diff --git a/gui/builtinStatsViews/priceViewMinimal.py b/gui/builtinStatsViews/priceViewMinimal.py index 421d3d983c..a928918fba 100644 --- a/gui/builtinStatsViews/priceViewMinimal.py +++ b/gui/builtinStatsViews/priceViewMinimal.py @@ -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: From 9737631f61cf5396fda06b460ab2679cfc8592ff Mon Sep 17 00:00:00 2001 From: Ryan Holmes Date: Fri, 19 May 2017 23:44:26 -0700 Subject: [PATCH 3/4] Update some migrations to consider new schema (#1185) * Update some migrations to consider new schema * tox (cherry picked from commit 2e2303c) --- eos/db/migrations/upgrade17.py | 44 ++++++++++++++++++---------------- eos/db/migrations/upgrade6.py | 4 ++-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/eos/db/migrations/upgrade17.py b/eos/db/migrations/upgrade17.py index 90ed6e646d..0ea7463554 100644 --- a/eos/db/migrations/upgrade17.py +++ b/eos/db/migrations/upgrade17.py @@ -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 diff --git a/eos/db/migrations/upgrade6.py b/eos/db/migrations/upgrade6.py index 724a940089..a6d0a51916 100644 --- a/eos/db/migrations/upgrade6.py +++ b/eos/db/migrations/upgrade6.py @@ -7,5 +7,5 @@ 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)) + saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', + (1, "Uniform", 25, 25, 25, 25, None, None, None)) From e828eb4d7d37587f761bb28e6d5d0c73495bbb84 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Sat, 20 May 2017 11:23:53 -0700 Subject: [PATCH 4/4] Handle both old and new DB schemas. --- eos/db/migrations/upgrade6.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/eos/db/migrations/upgrade6.py b/eos/db/migrations/upgrade6.py index a6d0a51916..4c0e58cf81 100644 --- a/eos/db/migrations/upgrade6.py +++ b/eos/db/migrations/upgrade6.py @@ -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, None, 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))