diff --git a/client/components/cards/LazySeriesCard.vue b/client/components/cards/LazySeriesCard.vue index c8bbf12c..72ce947f 100644 --- a/client/components/cards/LazySeriesCard.vue +++ b/client/components/cards/LazySeriesCard.vue @@ -119,9 +119,13 @@ export default { return this.seriesBookProgress.some((p) => !p.isFinished && p.progress > 0) }, seriesPercentInProgress() { - let totalFinishedAndInProgress = this.seriesBooksFinished.length - if (this.hasSeriesBookInProgress) totalFinishedAndInProgress += 1 - return Math.min(1, Math.max(0, totalFinishedAndInProgress / this.books.length)) + if (!this.books.length) return 0 + let progressPercent = 0 + this.seriesBookProgress.forEach((progress) => { + progressPercent += progress.isFinished ? 1 : progress.progress || 0 + }) + progressPercent /= this.books.length + return Math.min(1, Math.max(0, progressPercent)) }, isSeriesFinished() { return this.books.length === this.seriesBooksFinished.length diff --git a/client/cypress/tests/components/cards/LazySeriesCard.cy.js b/client/cypress/tests/components/cards/LazySeriesCard.cy.js index 7d11ead9..dae3b68c 100644 --- a/client/cypress/tests/components/cards/LazySeriesCard.cy.js +++ b/client/cypress/tests/components/cards/LazySeriesCard.cy.js @@ -26,7 +26,7 @@ describe('LazySeriesCard', () => { isCategorized: false, seriesMount: series, sortingIgnorePrefix: false, - orderBy: 'addedAt', + orderBy: 'addedAt' } const stubs = { @@ -126,7 +126,7 @@ describe('LazySeriesCard', () => { .and('have.class', 'bg-yellow-400') .and(($el) => { 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, 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') }) - -}) \ No newline at end of file +})