From c81229e81a6803e70aec6934de9ec90815b6f146 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 27 Mar 2015 18:47:54 -0700 Subject: [PATCH] Refresh .prices file when removing a station that had items listed --- CHANGES.txt | 1 + commands/station_cmd.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index b3fef9af..eca46585 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,6 +3,7 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014 ============================================================================== v6.15.0 Mar 27 2015 +. (kfsone) Refresh .prices file after removing a station that had items . (kfsone) Maddavo Plugin - Added support for "corrections" "--opt=corrections" and "--opt=csvs" will read Maddavo's correction data diff --git a/commands/station_cmd.py b/commands/station_cmd.py index b40daa36..aed0d4c4 100644 --- a/commands/station_cmd.py +++ b/commands/station_cmd.py @@ -6,6 +6,7 @@ from tradedb import System, Station from tradedb import TradeDB +import cache import csvexport import difflib import re @@ -287,6 +288,7 @@ def removeStation(tdb, cmdenv, station): db.commit() cmdenv.NOTE("{} (#{}) removed from {} database.", station.name(), station.ID, tdb.dbPath) + cmdenv.stationItemCount = station.itemCount return True @@ -300,6 +302,12 @@ def checkResultAndExportStations(tdb, cmdenv, result): lines, csvPath = csvexport.exportTableToFile(tdb, cmdenv, "Station") cmdenv.NOTE("{} updated.", csvPath) + + if cmdenv.remove: + if cmdenv.stationItemCount: + cmdenv.NOTE("Station had items, regenerating .prices file") + cache.regeneratePricesFile(tdb, cmdenv) + return None