Fixed bugs causing websites to report as "Not published" when listed in the UI.

This commit is contained in:
CalDescent 2023-01-29 18:05:04 +00:00
parent 4ba2f7ad6a
commit 3077810ea8

View File

@ -43,6 +43,7 @@ public class ArbitraryDataResource {
private int layerCount; private int layerCount;
private Integer localChunkCount = null; private Integer localChunkCount = null;
private Integer totalChunkCount = null; private Integer totalChunkCount = null;
private boolean exists = false;
public ArbitraryDataResource(String resourceId, ResourceIdType resourceIdType, Service service, String identifier) { public ArbitraryDataResource(String resourceId, ResourceIdType resourceIdType, Service service, String identifier) {
this.resourceId = resourceId.toLowerCase(); this.resourceId = resourceId.toLowerCase();
@ -61,12 +62,11 @@ public class ArbitraryDataResource {
// Avoid this for "quick" statuses, to speed things up // Avoid this for "quick" statuses, to speed things up
if (!quick) { if (!quick) {
this.calculateChunkCounts(); this.calculateChunkCounts();
}
if (this.totalChunkCount == null || this.totalChunkCount == 0) { if (!this.exists) {
// Assume not published
return new ArbitraryResourceStatus(Status.NOT_PUBLISHED, this.localChunkCount, this.totalChunkCount); return new ArbitraryResourceStatus(Status.NOT_PUBLISHED, this.localChunkCount, this.totalChunkCount);
} }
}
if (resourceIdType != ResourceIdType.NAME) { if (resourceIdType != ResourceIdType.NAME) {
// We only support statuses for resources with a name // We only support statuses for resources with a name
@ -224,11 +224,14 @@ public class ArbitraryDataResource {
try { try {
this.fetchTransactions(); this.fetchTransactions();
if (this.transactions == null) { if (this.transactions == null) {
this.exists = false;
this.localChunkCount = 0; this.localChunkCount = 0;
this.totalChunkCount = 0; this.totalChunkCount = 0;
return; return;
} }
this.exists = true;
List<ArbitraryTransactionData> transactionDataList = new ArrayList<>(this.transactions); List<ArbitraryTransactionData> transactionDataList = new ArrayList<>(this.transactions);
int localChunkCount = 0; int localChunkCount = 0;
int totalChunkCount = 0; int totalChunkCount = 0;