From bdf78cad791770ad61048bb3c24c8fa0e1a98156 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 23 May 2022 21:25:03 +1000 Subject: [PATCH] fix total offset error --- .../fhir/validation/instance/InstanceValidator.java | 2 +- .../fhir/validation/instance/PercentageTracker.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index ff10ddba6..94b009123 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -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) { diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/PercentageTracker.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/PercentageTracker.java index 536ce0d38..2d2cddb70 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/PercentageTracker.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/PercentageTracker.java @@ -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); + } } } }