Skip to content

Commit

Permalink
Close initialising at 10% synced (#115, #117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rik Smith-Unna committed Jul 2, 2017
1 parent 78a7114 commit 22da29e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/client/models/datasources.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ module.exports = (state, bus) => {
const news = sources.map(ds => ds.data())

// update initialising
const anyfinished = any(news, ds => ds.stats.metadataSync.finished)
if (anyfinished) {
const any10pc = any(news, ds => {
const d = ds.stats.metadataSync
return d.finished || d.done / d.total >= 0.1
})
if (any10pc) {
if (state.initialising) bus.emit('initialising:stop')
} else {
if (!state.initialising) bus.emit('initialising:start')
Expand Down
4 changes: 2 additions & 2 deletions app/client/views/initial.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ module.exports = (state, emit) => {
finished: false
}

const synced = metastat.finished
const synced = metastat.done / metastat.total >= 0.1
? '100%'
: numeral(`${metastat.done / metastat.total}`).format('0%')
: numeral(`${metastat.done / (metastat.total / 10)}`).format('0%')

const remaining = html`
Expand Down

0 comments on commit 22da29e

Please sign in to comment.