Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
fix progress indicator in case of 0 incopmlete dats #311
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Mar 21, 2017
1 parent ced32dc commit cb11436
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions models/repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,11 @@ function createModel () {
var incomplete = dats.filter(function (dat) {
return dat.network && dat.progress < 1
})
var progress = incomplete.reduce(function (acc, dat) {
return acc + dat.progress
}, 0) / incomplete.length
var progress = incomplete.length
? incomplete.reduce(function (acc, dat) {
return acc + dat.progress
}, 0) / incomplete.length
: 1
if (progress === 1) progress = -1 // deactivate

ipc.send('progress', progress)
Expand Down

0 comments on commit cb11436

Please sign in to comment.