mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18: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) | ||||
|     }, | ||||
|     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 | ||||
|  | ||||
| @ -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') | ||||
|   }) | ||||
| 
 | ||||
| }) | ||||
| }) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user