Skip to content

Commit

Permalink
Code: Delete known invalid tracker asset locations
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenGnu committed Jun 5, 2018
1 parent 9e65d4a commit e884727
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
import net.nikr.eve.jeveasset.gui.shared.components.JSelectionDialog;
import net.nikr.eve.jeveasset.gui.shared.menu.JMenuInfo;
import net.nikr.eve.jeveasset.gui.tabs.values.AssetValue;
import net.nikr.eve.jeveasset.gui.tabs.values.DataSetCreator;
import net.nikr.eve.jeveasset.gui.tabs.values.Value;
import net.nikr.eve.jeveasset.i18n.General;
import net.nikr.eve.jeveasset.i18n.TabsTracker;
Expand Down Expand Up @@ -555,6 +556,7 @@ public String generateToolTip(XYDataset dataset, int series, int item) {
.addComponent(jOwnersScroll, 70, 70, Integer.MAX_VALUE)
)
);
DataSetCreator.purgeInvalidTrackerAssetValues();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ public static Value getValue(Map<String, Value> values, String owner, Date date)
return getCreator().getValueInner(values, owner, date);
}

public static void purgeInvalidTrackerAssetValues() {
for (List<Value> values : Settings.get().getTrackerData().values()) {
for (Value value : values) {
List<AssetValue> assetValues = new ArrayList<>(value.getAssetsFilter().keySet()); //Copy to allow modification of original during the loop
for (AssetValue assetValue : assetValues) {
Long locationID = assetValue.getLocationID();
if (locationID != null &&
(
Settings.get().getAssetAdded().containsKey(locationID) //Confirmed asset AKA not a location, must be destroyed asset!
|| locationID > 9000000000000000000L //9e18 locations: https://github.com/ccpgames/esi-issues/issues/684
|| (locationID > 40000000 && locationID < 50000000) //Deleted PI structures: https://github.com/esi/esi-issues/issues/943
)
) {
value.getAssetsFilter().remove(assetValue);
Settings.get().getTrackerFilters().remove(assetValue.getID());
}
}
}
}
}

private static DataSetCreator getCreator() {
if (creator == null) {
creator = new DataSetCreator();
Expand Down Expand Up @@ -83,6 +104,7 @@ private void createTrackerDataPointInner(ProfileData profileData, Date date) {
list.add(value);

}
purgeInvalidTrackerAssetValues();
Settings.unlock("Tracker Data (Create Point)");
}

Expand Down

0 comments on commit e884727

Please sign in to comment.