czue / czue/celery-progress

DOM only updating last element of the loop while diplaying progress

Open
#104 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
497
Forks
89
PR merge metrics
No merged PRs in 30d

Description

I had an issue while diplaying the progress bar in HTML for a bunch of tasks which was being initiated in a loop. While the CeleryProgressBar was initiated for all the tasks, the progress was only being updated for the last task in the loop.

For a quick fix I had to create a function updateElements everytime before onProgress was called.

```
updateElements(){
this.progressBarElement = document.getElementById(this.progressBarElement.getAttribute('id'))
this.progressBarMessageElement = document.getElementById(this.progressBarMessageElement.getAttribute('id'))
}
onData(data) {
let done = false;
if (data.progress) {
this.updateElements()
this.onProgress(this.progressBarElement, this.progressBarMessageElement, data.progress);
}
........
}
```

This solved my issue but would like to know if there is a better solution

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.