mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Fix series progress to show sum of series book progresses
This commit is contained in:
parent
e384527b67
commit
057bc1a0c0
@ -119,9 +119,13 @@ export default {
|
|||||||
return this.seriesBookProgress.some((p) => !p.isFinished && p.progress > 0)
|
return this.seriesBookProgress.some((p) => !p.isFinished && p.progress > 0)
|
||||||
},
|
},
|
||||||
seriesPercentInProgress() {
|
seriesPercentInProgress() {
|
||||||
let totalFinishedAndInProgress = this.seriesBooksFinished.length
|
if (!this.books.length) return 0
|
||||||
if (this.hasSeriesBookInProgress) totalFinishedAndInProgress += 1
|
let progressPercent = 0
|
||||||
return Math.min(1, Math.max(0, totalFinishedAndInProgress / this.books.length))
|
this.seriesBookProgress.forEach((progress) => {
|
||||||
|
progressPercent += progress.isFinished ? 1 : progress.progress || 0
|
||||||
|
})
|
||||||
|
progressPercent /= this.books.length
|
||||||
|
return Math.min(1, Math.max(0, progressPercent))
|
||||||
},
|
},
|
||||||
isSeriesFinished() {
|
isSeriesFinished() {
|
||||||
return this.books.length === this.seriesBooksFinished.length
|
return this.books.length === this.seriesBooksFinished.length
|
||||||
|
@ -26,7 +26,7 @@ describe('LazySeriesCard', () => {
|
|||||||
isCategorized: false,
|
isCategorized: false,
|
||||||
seriesMount: series,
|
seriesMount: series,
|
||||||
sortingIgnorePrefix: false,
|
sortingIgnorePrefix: false,
|
||||||
orderBy: 'addedAt',
|
orderBy: 'addedAt'
|
||||||
}
|
}
|
||||||
|
|
||||||
const stubs = {
|
const stubs = {
|
||||||
@ -126,7 +126,7 @@ describe('LazySeriesCard', () => {
|
|||||||
.and('have.class', 'bg-yellow-400')
|
.and('have.class', 'bg-yellow-400')
|
||||||
.and(($el) => {
|
.and(($el) => {
|
||||||
const width = $el.width()
|
const width = $el.width()
|
||||||
expect(width).to.be.closeTo((2 / 3) * propsData.width, 0.01)
|
expect(width).to.be.closeTo(((1 + 0.5) / 3) * propsData.width, 0.01)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -137,7 +137,9 @@ describe('LazySeriesCard', () => {
|
|||||||
...mocks.$store,
|
...mocks.$store,
|
||||||
getters: {
|
getters: {
|
||||||
...mocks.$store.getters,
|
...mocks.$store.getters,
|
||||||
'user/getUserMediaProgress': (id) => { return { isFinished: true } }
|
'user/getUserMediaProgress': (id) => {
|
||||||
|
return { isFinished: true }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,5 +214,4 @@ describe('LazySeriesCard', () => {
|
|||||||
|
|
||||||
cy.get('&detailBottomDisplayTitle').should('have.text', 'Lord of the Rings')
|
cy.get('&detailBottomDisplayTitle').should('have.text', 'Lord of the Rings')
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user