Skip to content

Commit

Permalink
Added timestamp sanity check for Systems to avoid constraint errors d…
Browse files Browse the repository at this point in the history
…uring importing new systems
  • Loading branch information
kfsone committed Apr 19, 2015
1 parent 5df60bd commit 6257bdc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
v6.18.3 Apr 19 2015
. (kfsone) Added "--shorten" (requires --to)
Will show routes with less hops if they produces a better gpt
. (kfsone) "import" maddavo plugin:
- Added sanity checking of timestamps during System.csv import
(there was a new system in mad's data with an apostrophe in the
modified timestamp)
+ (kfsone) ~310 new systems

v6.18.2 Apr 18 2015
Expand Down
8 changes: 8 additions & 0 deletions plugins/maddavo_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def import_systems(self):
"""

tdb, tdenv = self.tdb, self.tdenv
dateTimeRe = re.compile(r'\s*(\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2})')

stream = self.csv_system_rows(SYSTEMS_URL, "Systems")
for sysName, system, values in stream:
Expand All @@ -287,6 +288,13 @@ def import_systems(self):
self.modSystems += 1
continue

# Clean up the modified stamp
m = dateTimeRe.match(modified)
if not m:
tdenv.WARN("{} has invalid 'modified': {}", sysName, modified)
continue
modified = m.group(1)

x, y, z = float(values[1]), float(values[2]), float(values[3])
if not system:
tdb.addLocalSystem(
Expand Down

0 comments on commit 6257bdc

Please sign in to comment.