Skip to content

Commit

Permalink
fix(Progress Bar): Check for a valid total to avoid wrong percentages (
Browse files Browse the repository at this point in the history
…#1531)

* fix(Progress Bar): Check for a valid total to avoid wrong percentages

* fix(Progress Bar): If percentage is NaN return 0

* fix(Progress Bar): Check for a valid total to avoid wrong percentages

* fix(Progress Bar): Code Cleanup
  • Loading branch information
Vonterio authored Apr 19, 2024
1 parent 8e24b4d commit 6e942a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/novo-elements/src/elements/progress/ProgressBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class NovoProgressBarElement implements ControlValueAccessor, OnInit {
if (this.value !== value) {
this._value = value;
if (this.progress) {
this._percent = this.value / this.progress.total;
this._percent = this.progress.total > 0 ? this._value / this.progress.total : 0;
} else {
this._percent = value;
}
Expand Down Expand Up @@ -132,7 +132,7 @@ export class NovoProgressBarElement implements ControlValueAccessor, OnInit {
this.progress.fitContainer = true;
}
if (this.progress) {
this._percent = this._value / this.progress.total;
this._percent = this.progress.total > 0 ? this._value / this.progress.total : 0;
this.appearance = this.progress.appearance;
}
}
Expand Down

0 comments on commit 6e942a7

Please sign in to comment.