Skip to content

Commit

Permalink
process_tracker_python-71 Extract Location Names
Browse files Browse the repository at this point in the history
✨ Location Names are now ensured to be unique (number added to end)
🐛 Paths that end in filename should now use parent directory for location name

Closes #71
  • Loading branch information
OpenDataAlex committed Jul 19, 2019
1 parent 8907b9b commit 0be167c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions process_tracker/location_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def derive_location_name(self):
location_prefix = None

current_name = (
self.session.query(Location.location_name)
self.session.query(Location)
.filter(Location.location_path == self.location_path)
.first()
)

if current_name is not None:
location_name = current_name[0].location_name
location_name = current_name.location_name
else:
location_name = ""

Expand Down
4 changes: 2 additions & 2 deletions tests/test_extract_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def test_derive_location_name_local_path(self):
)

given_result = location[0].location_name
expected_result = "extract_dir2"
expected_result = "local - extract_dir2"

self.assertEqual(expected_result, given_result)

Expand All @@ -266,7 +266,7 @@ def test_derive_location_name_s3(self):
)

given_result = location[0].location_name
expected_result = "s3 - extract_dir"
expected_result = "s3 test-test - extract_dir"

self.assertEqual(expected_result, given_result)

Expand Down

0 comments on commit 0be167c

Please sign in to comment.