Bug Fix
Changes: - If an out of range update is received, set the current progress to zero or max to avoid getting stuck on the default value when the page is loaded after exceeding the goal.
This commit is contained in:
+15
-1
@@ -41,8 +41,22 @@ class ProgressBar {
|
||||
&& (val <= this.max_progress)
|
||||
&& (val != this.current_progress)) {
|
||||
this.current_progress = val;
|
||||
this.anim_progress = 0;
|
||||
this.anim_progress = 0;
|
||||
} else {
|
||||
if (Number.isInteger(val)
|
||||
&& (val >= this.max_progress)
|
||||
&& (val != this.current_progress)) {
|
||||
this.current_progress = this.max_progress;
|
||||
this.anim_progress = 0;
|
||||
console.warn("Progress update: Goal Exceeded.")
|
||||
}
|
||||
if (Number.isInteger(val)
|
||||
&& (val <= 0)
|
||||
&& (val != this.current_progress)) {
|
||||
this.current_progress = 0;
|
||||
this.anim_progress = 0;
|
||||
console.warn("Progress update: Goal Subceeded.")
|
||||
}
|
||||
console.warn("Progress update failed.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user