Skip to content

Commit addb5c0

Browse files
committed
Progress bar layout fix
1 parent 401deea commit addb5c0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/org/radarcns/hdfs/RestructureAvroRecords.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public void start(String directoryName) throws IOException {
204204

205205
logger.info("Converting {} files", toProcessFileCount);
206206

207-
ProgressBar progressBar = new ProgressBar(toProcessFileCount, 10);
207+
ProgressBar progressBar = new ProgressBar(toProcessFileCount, 80);
208208
progressBar.update(0);
209209

210210
// Actually process the files

src/main/java/org/radarcns/hdfs/util/ProgressBar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public void update(long remain) {
4444
}
4545
int remainPercent;
4646
if (total > 0) {
47-
remainPercent = (int) ((100 * remain) / total);
47+
remainPercent = Math.min((int) ((100 * remain) / total), 100);
4848
} else {
4949
remainPercent = 100;
5050
}
5151
if (remainPercent == previousPercentage) {
5252
return;
5353
}
5454
previousPercentage = remainPercent;
55-
int stripesFilled = remainPercent / numStripes;
55+
int stripesFilled = numStripes * remainPercent / 100;
5656
char notFilled = '-';
5757
char filled = '*';
5858
// 2 init + numStripes + 2 end + 4 percentage

0 commit comments

Comments
 (0)