fix total offset error

This commit is contained in:
Grahame Grieve 2022-05-23 21:25:03 +10:00
parent 47e205883c
commit bdf78cad79
2 changed files with 8 additions and 5 deletions

View File

@ -4397,7 +4397,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
// this method is reentrant, but also the right place to tell the user what is going on if it's the root.
// if we're not at the root, we don't report progress
pctOwned = true;
pct = new PercentageTracker(resource.countDescendents(), resource.fhirType(), defn.getUrl());
pct = new PercentageTracker(resource.countDescendents()+1, resource.fhirType(), defn.getUrl());
}
if (BUNDLE.equals(element.fhirType())) {
if (debug) {

View File

@ -25,11 +25,14 @@ public class PercentageTracker {
if (e.getInstanceId() != instance) {
e.setInstanceId(instance);
current++;
int pct = (current*100) / total;
if (pct > last + 5) {
while (last + 5 < pct) {
int pct = total == 0 ? 0: (current*100) / total;
if (pct > last + 2) {
while (last + 2 < pct) {
System.out.print(".");
last = last + 5;
last = last + 2;
if (last % 20 == 0) {
System.out.print(""+last);
}
}
}
}