3
0
mirror of https://github.com/Qortal/qortal.git synced 2025-02-14 11:15:49 +00:00

Add "percentLoaded" to resource statuses.

This commit is contained in:
CalDescent 2023-03-31 17:27:04 +01:00
parent a83e332c11
commit 073d124aef

View File

@ -34,6 +34,7 @@ public class ArbitraryResourceStatus {
private Integer localChunkCount; private Integer localChunkCount;
private Integer totalChunkCount; private Integer totalChunkCount;
private Float percentLoaded;
public ArbitraryResourceStatus() { public ArbitraryResourceStatus() {
} }
@ -45,6 +46,7 @@ public class ArbitraryResourceStatus {
this.description = status.description; this.description = status.description;
this.localChunkCount = localChunkCount; this.localChunkCount = localChunkCount;
this.totalChunkCount = totalChunkCount; this.totalChunkCount = totalChunkCount;
this.percentLoaded = (this.localChunkCount != null && this.totalChunkCount != null) ? this.localChunkCount / (float)this.totalChunkCount * 100.0f : null;
} }
public ArbitraryResourceStatus(Status status) { public ArbitraryResourceStatus(Status status) {