Skip to content

Commit

Permalink
Merge branch 'main' into native
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenGnu committed Oct 26, 2024
2 parents 58d6e5e + 935c2ce commit 8c2b23f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 26 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1295,13 +1295,13 @@
<!-- http://logback.qos.ch/news.html -->
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
<version>1.2.13</version>
</dependency>
<dependency>
<!-- use logback for logging -->
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.11</version>
<version>1.2.13</version>
</dependency>
<dependency>
<!-- https://github.com/jfree/jfreechart/releases -->
Expand All @@ -1319,7 +1319,7 @@
<!-- https://github.com/xerial/sqlite-jdbc/releases -->
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
<version>3.41.2.2</version>
</dependency>
<dependency>
<!-- https://github.com/remkop/picocli/releases -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ public int compare(StockpileFilter o1, StockpileFilter o2) {
}
//Jobs
} else if (industryJob != null) {
//Note: Industry jobs are also filtered for isNotDeliveredToAssets() in StockpileData.updateStockpileItems(Stockpile, boolean)
if (typeID < 0) { //Copying in progress (not delivered to assets)
if (filter.isJobs() && industryJob.isCopying() && industryJob.isNotDeliveredToAssets()) {
if (runs) { //BPC Runs
Expand All @@ -893,7 +894,8 @@ public int compare(StockpileFilter o1, StockpileFilter o2) {
}
}
}
//Manufacturing in progress (not delivered to assets)
//Manufacturing in progress (not delivered to assets)
//Note: Industry jobs are also filtered for isNotDeliveredToAssets() in StockpileData.updateStockpileItems(Stockpile, boolean)
} else if (filter.isJobs() && industryJob.isManufacturing() && industryJob.isNotDeliveredToAssets()) {
if (add) { //Match
jobsCountNow = jobsCountNow + ((long)industryJob.getRuns() * (long)industryJob.getProductQuantity());
Expand All @@ -908,12 +910,14 @@ public int compare(StockpileFilter o1, StockpileFilter o2) {
if (runs && typeID < 0) {
continue; //Ignore BPC runs (Can't sell BPC)
}
//Note: Market orders are also filtered for isActive() in StockpileData.updateStockpileItems(Stockpile, boolean)
if (!marketOrder.isBuyOrder() && marketOrder.isActive() && filter.isSellOrders()) {
if (add) { //Open/Active sell order - match
sellOrdersCountNow = sellOrdersCountNow + marketOrder.getVolumeRemain();
} else {
count = count + marketOrder.getVolumeRemain();
}
//Note: Market orders are also filtered for isActive() in StockpileData.updateStockpileItems(Stockpile, boolean)
} else if (marketOrder.isBuyOrder() && marketOrder.isActive() && filter.isBuyOrders()) {
if (add) { //Open/Active buy order - match
buyOrdersCountNow = buyOrdersCountNow + marketOrder.getVolumeRemain();
Expand All @@ -928,12 +932,14 @@ public int compare(StockpileFilter o1, StockpileFilter o2) {
if (runs && typeID < 0) {
continue; //Ignore BPC runs (Can't sell BPC)
}
//Note: Transactions are also filter for isAfterAssets() in StockpileData.updateStockpileItems(Stockpile, boolean)
if (transaction.isAfterAssets() && transaction.isBuy() && filter.isBuyTransactions()) {
if (add) { //Buy - match
buyTransactionsCountNow = buyTransactionsCountNow + transaction.getQuantity();
} else {
count = count + transaction.getQuantity();
}
//Note: Transactions are also filter for isAfterAssets() in StockpileData.updateStockpileItems(Stockpile, boolean)
} else if (transaction.isAfterAssets() && transaction.isSell() && filter.isSellTransactions()) {
if (add) { //Sell - match
sellTransactionsCountNow = sellTransactionsCountNow - transaction.getQuantity();
Expand All @@ -956,13 +962,15 @@ public int compare(StockpileFilter o1, StockpileFilter o2) {
boolean isAcceptor = contractItem.getContract().getAcceptorID() > 0 && matchOwner(filter, contractItem.getContract().getAcceptorID());
//Sell: Issuer Included or Acceptor Excluded
if ((isIssuer && contractItem.isIncluded()) || (isAcceptor && !contractItem.isIncluded())) {
//Note: Contract items are also filter for isOpen() in StockpileData.updateStockpileItems(Stockpile, boolean)
if (contractItem.getContract().isOpen() && filter.isSellingContracts()) {
if (add) { //Selling
sellingContractsCountNow = sellingContractsCountNow + contractItem.getQuantity();
} else {
count = count + contractItem.getQuantity();
}
found = true;
//Note: Contract items are also filter for isCompletedSuccessful() in StockpileData.updateStockpileItems(Stockpile, boolean)
} else if (contractItem.getContract().isCompletedSuccessful() && filter.isSoldContracts()) { //Sold
if ((isIssuer && contractItem.getContract().isIssuerAfterAssets())
|| isAcceptor && contractItem.getContract().isAcceptorAfterAssets()) {
Expand All @@ -977,13 +985,15 @@ public int compare(StockpileFilter o1, StockpileFilter o2) {
}
//Buy: Issuer Excluded or Acceptor Included
if ((isIssuer && !contractItem.isIncluded()) || (isAcceptor && contractItem.isIncluded())) {
//Note: Contract items are also filter for isOpen() in StockpileData.updateStockpileItems(Stockpile, boolean)
if (contractItem.getContract().isOpen() && filter.isBuyingContracts()) {
if (add) { //Buying
buyingContractsCountNow = buyingContractsCountNow + contractItem.getQuantity();
} else {
count = count + contractItem.getQuantity();
}
found = true;
//Note: Contract items are also filter for isCompletedSuccessful() in StockpileData.updateStockpileItems(Stockpile, boolean)
} else if (contractItem.getContract().isCompletedSuccessful() && filter.isBoughtContracts()) { //Bought
if ((isIssuer && contractItem.getContract().isIssuerAfterAssets())
|| isAcceptor && contractItem.getContract().isAcceptorAfterAssets()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ private void updateStockpileItems(Stockpile stockpile, boolean updateClaims) {
if (contractItem.getContract().isIgnoreContract()) {
continue;
}
if (!contractItem.getContract().isOpen() && !contractItem.getContract().isCompletedSuccessful() ) {
continue; //Only include open and successfully completed contracts
}
Integer typeID = get(contractItem.getTypeID(), contractItem.isBPC());
//Ignore null and wrong typeID
if (ignore(typeIDs, typeID)) {
Expand Down Expand Up @@ -203,6 +206,9 @@ private void updateStockpileItems(Stockpile stockpile, boolean updateClaims) {
//Market Orders
if (stockpile.isBuyOrders() || stockpile.isSellOrders()) {
for (MyMarketOrder marketOrder : profileData.getMarketOrdersList()) {
if (!marketOrder.isActive()) {
continue; //Only include active orders
}
Integer typeID = marketOrder.getTypeID();
//Ignore null and wrong typeID
if (ignore(typeIDs, typeID)) {
Expand All @@ -215,6 +221,9 @@ private void updateStockpileItems(Stockpile stockpile, boolean updateClaims) {
//Industry Jobs
if (stockpile.isJobs()) {
for (MyIndustryJob industryJob : profileData.getIndustryJobsList()) {
if (!industryJob.isNotDeliveredToAssets()) {
continue; //Only include industry jobs not delivered
}
//Manufacturing
Integer productTypeID = industryJob.getProductTypeID();
if (!ignore(typeIDs, productTypeID)) { //Ignore null and wrong typeID
Expand All @@ -230,6 +239,9 @@ private void updateStockpileItems(Stockpile stockpile, boolean updateClaims) {
//Transactions
if (stockpile.isTransactions()) {
for (MyTransaction transaction : profileData.getTransactionsList()) {
if (!transaction.isAfterAssets()) {
continue; //Only include transaction made after the last asset update
}
Integer typeID = transaction.getTypeID();
//Ignore null and wrong typeID
if (typeID == null || !typeIDs.contains(typeID)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import net.nikr.eve.jeveasset.Program;
import net.nikr.eve.jeveasset.data.api.accounts.OwnerType;
import net.nikr.eve.jeveasset.data.api.my.MyAsset;
import net.nikr.eve.jeveasset.data.api.my.MyContract;
import net.nikr.eve.jeveasset.data.api.my.MyIndustryJob;
import net.nikr.eve.jeveasset.data.api.my.MyMarketOrder;
import net.nikr.eve.jeveasset.data.sde.ItemFlag;
Expand Down Expand Up @@ -571,6 +572,19 @@ void updateData() {
myLocations.add(marketOrder.getLocation().getConstellation());
myLocations.add(marketOrder.getLocation().getRegion());
}
for (MyContract contract : program.getContractList()) {
if (!contract.isOpen()) {
continue; //Only include open contracts
}
myLocations.add(contract.getStartLocation().getLocation());
myLocations.add(contract.getStartLocation().getSystem());
myLocations.add(contract.getStartLocation().getConstellation());
myLocations.add(contract.getStartLocation().getRegion());
myLocations.add(contract.getEndLocation().getLocation());
myLocations.add(contract.getEndLocation().getSystem());
myLocations.add(contract.getEndLocation().getConstellation());
myLocations.add(contract.getEndLocation().getRegion());
}
//Containers
containers.clear();
containers.addAll(containerSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package net.nikr.eve.jeveasset.io.esi;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -77,31 +78,30 @@ protected void update() throws ApiException {
AtomicInteger count = new AtomicInteger(0);
//Update public market orders
publicMarketOrders = true;
List<MarketOrdersResponse> responses = updatePagedList(input.getRegionIDs(), new PagedListHandler<Integer, MarketOrdersResponse>() {
@Override
protected List<MarketOrdersResponse> get(Integer k) throws ApiException {
try {
return updatePages(DEFAULT_RETRIES, new EsiPagesHandler<MarketOrdersResponse>() {
@Override
public ApiResponse<List<MarketOrdersResponse>> get(Integer page) throws ApiException {
ApiResponse<List<MarketOrdersResponse>> response = getMarketApiOpen().getMarketsRegionIdOrdersWithHttpInfo("all", k, DATASOURCE, null, page, null);
String header = getHeader(response.getHeaders(), "last-modified");
if (header != null) {
Date date = Formatter.parseExpireDate(header);
if (lastUpdate == null) {
lastUpdate = date;
} else if (!modified && !lastUpdate.equals(date)){
modified = true;
}
List<MarketOrdersResponse> responses = new ArrayList<>();
for (Integer k : input.getRegionIDs()) {
try {
List<MarketOrdersResponse> response = updatePages(DEFAULT_RETRIES, new EsiPagesHandler<MarketOrdersResponse>() {
@Override
public ApiResponse<List<MarketOrdersResponse>> get(Integer page) throws ApiException {
ApiResponse<List<MarketOrdersResponse>> response = getMarketApiOpen().getMarketsRegionIdOrdersWithHttpInfo("all", k, DATASOURCE, null, page, null);
String header = getHeader(response.getHeaders(), "last-modified");
if (header != null) {
Date date = Formatter.parseExpireDate(header);
if (lastUpdate == null) {
lastUpdate = date;
} else if (!modified && !lastUpdate.equals(date)){
modified = true;
}
return response;
}
});
} finally {
setProgressAll(input.getRegionIDs().size(), count.incrementAndGet(), 0, 40);
}
return response;
}
});
responses.addAll(response);
} finally {
setProgressAll(input.getRegionIDs().size(), count.incrementAndGet(), 0, 40);
}
});
}
if (modified) {
addWarning("last-modified changed while updating", "Cache expired while updating");
}
Expand Down

0 comments on commit 8c2b23f

Please sign in to comment.