From 77710ae19115ad6621e579ca625e3c1856015288 Mon Sep 17 00:00:00 2001 From: cjo20 Date: Sat, 27 Feb 2016 23:11:19 +0000 Subject: [PATCH 1/5] Strip useless information from gas/relic/data sites --- evewspace/Map/models.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/evewspace/Map/models.py b/evewspace/Map/models.py index 4a8afefe..d3383c62 100755 --- a/evewspace/Map/models.py +++ b/evewspace/Map/models.py @@ -784,6 +784,28 @@ def update(self): self.updated = True self.save() + null_races = ["Angel", "Sansha", "Gurista", "Blood Raider"] + + + def abbreviate_info(self): + if self.sigtype and self.info: + type = self.sigtype.shortname + info = self.info + + if type == "GAS": + self.info = info.split(' ', 1)[0] + elif (type == "DATA") or (type == "RELIC"): + new_info = "" + for race in self.null_races: + if race in info: + new_info += "NULL " + race + if ("Covert Research" in info): + new_info += " Covert Research" + self.info = new_info + return + self.info = info.split(' ', 3)[2] + + def update_from_tsv(self, user, wascreated, row, map_system): """Takes a line of copied data, converts it into a signature and checks if the import updated an existing signature on the map, and whether or not the update @@ -832,11 +854,14 @@ def update_from_tsv(self, user, wascreated, row, map_system): # if there is a signature info (site name) field, mark as scanned if self.info != info: self.info = info + if self.sigtype: + self.abbreviate_info() if action != "Created": action = "Updated" if scan_group == "Cosmic Signature": # only record new scanning activity for signatures action = "Scanned" + if action != "None": self.log_sig(user, action, map_system) From 8ef46adbd97bf480b91c5c9b91db3bb813364625 Mon Sep 17 00:00:00 2001 From: cjo20 Date: Sun, 28 Feb 2016 01:01:40 +0000 Subject: [PATCH 2/5] Don't try and cut off first two words in data/relic if there are fewer than 3 words --- evewspace/Map/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evewspace/Map/models.py b/evewspace/Map/models.py index d3383c62..b50c0e79 100755 --- a/evewspace/Map/models.py +++ b/evewspace/Map/models.py @@ -803,7 +803,7 @@ def abbreviate_info(self): new_info += " Covert Research" self.info = new_info return - self.info = info.split(' ', 3)[2] + self.info = ' '.join(info.split(' ')[-2:]) def update_from_tsv(self, user, wascreated, row, map_system): From b425293368c16339969a6b09ef9dda5f82b56f94 Mon Sep 17 00:00:00 2001 From: cjo20 Date: Sun, 28 Feb 2016 01:03:45 +0000 Subject: [PATCH 3/5] Actually submit the change --- evewspace/Map/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/evewspace/Map/models.py b/evewspace/Map/models.py index b50c0e79..83fc60ca 100755 --- a/evewspace/Map/models.py +++ b/evewspace/Map/models.py @@ -803,7 +803,8 @@ def abbreviate_info(self): new_info += " Covert Research" self.info = new_info return - self.info = ' '.join(info.split(' ')[-2:]) + if info.count(' ') > 2: + self.info = info.split(' ', 3)[2] def update_from_tsv(self, user, wascreated, row, map_system): From 2ab4998ccf9e1393da4850a31605607315f1fa59 Mon Sep 17 00:00:00 2001 From: cjo20 Date: Sun, 28 Feb 2016 01:07:02 +0000 Subject: [PATCH 4/5] Revert "Actually submit the change" This reverts commit b425293368c16339969a6b09ef9dda5f82b56f94. --- evewspace/Map/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/evewspace/Map/models.py b/evewspace/Map/models.py index 83fc60ca..b50c0e79 100755 --- a/evewspace/Map/models.py +++ b/evewspace/Map/models.py @@ -803,8 +803,7 @@ def abbreviate_info(self): new_info += " Covert Research" self.info = new_info return - if info.count(' ') > 2: - self.info = info.split(' ', 3)[2] + self.info = ' '.join(info.split(' ')[-2:]) def update_from_tsv(self, user, wascreated, row, map_system): From 1367d3251626b08b455543bae0b3b3dc58eccd4a Mon Sep 17 00:00:00 2001 From: cjo20 Date: Sun, 28 Feb 2016 01:08:39 +0000 Subject: [PATCH 5/5] >= 2. Stop coding while tired --- evewspace/Map/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/evewspace/Map/models.py b/evewspace/Map/models.py index b50c0e79..11024783 100755 --- a/evewspace/Map/models.py +++ b/evewspace/Map/models.py @@ -803,7 +803,8 @@ def abbreviate_info(self): new_info += " Covert Research" self.info = new_info return - self.info = ' '.join(info.split(' ')[-2:]) + if info.count(' ') >= 2: + self.info = info.split(' ', 3)[2] def update_from_tsv(self, user, wascreated, row, map_system):