diff --git a/README.txt b/README.txt index 5423dddc..81fcc1cf 100644 --- a/README.txt +++ b/README.txt @@ -28,6 +28,10 @@ v4.3.0 Oct 17/2014 value for demand/stock levels "0" instead of "-1". (-1 means 'unknown'. Use this option if you are editing timestamps and stock levels and all those '-'s get in your way) +. (gazelle) Moved Star, System, etc data out of ".sql" file and into + per-table ".csv" files. This should make it much easier for people to + share and synchronize data and make it less daunting for people to + maintain their data files. Great work, Gazelle! v4.2.3 Oct 17/2014 . (ShadowGar, Smacker65) Imported Harbinger and RedWizzard system data, diff --git a/tradedb.py b/tradedb.py index 8717ffa0..1c068c95 100644 --- a/tradedb.py +++ b/tradedb.py @@ -413,22 +413,16 @@ def getMostRecentTimestamp(altPath): sqlTimestamp, pricesTimestamp = getMostRecentTimestamp(self.sqlPath), getMostRecentTimestamp(self.pricesPath) # rebuild if the sql or prices file is more recent than the db file - rebuild = ( max(sqlTimestamp, pricesTimestamp) >= dbFileCreatedTimestamp ) - if not rebuild: - # check if any table files have changed - for (fileName, tableName) in self.importTables: - if getMostRecentTimestamp(Path(fileName)) > dbFileCreatedTimestamp: - if self.debug: print("* file '{}' updated".format(fileName)) - rebuild = True - break - - if not rebuild: - if self.debug > 1: - print("- SQLite is up to date") - return - - if self.debug: - print("* Rebuilding DB Cache [db:{}, sql:{}, prices:{}]".format(dbFileCreatedTimestamp, sqlTimestamp, pricesTimestamp)) + if max(sqlTimestamp, pricesTimestamp) < dbFileCreatedTimestamp: + # sql and prices file are older than the db, db may be upto date, + # check if any of the table files have changed. + changedFiles = [ fileName for (fileName, _) in self.importTables if getMostRecentTimestamp(Path(fileName)) > dbFileCreatedTimestamp ] + if not changedFiles: + if self.debug > 1: print("- DB Cache is up to date.") + return + if self.debug: print("* Rebuilding DB Cache because of modified {}".format(', '.join(changedFiles))) + else: + if self.debug: print("* Rebuilding DB Cache [db:{}, sql:{}, prices:{}]".format(dbFileCreatedTimestamp, sqlTimestamp, pricesTimestamp)) else: if self.debug: print("* Building DB cache")