diff --git a/API.Tests/Helpers/EntityFactory.cs b/API.Tests/Helpers/EntityFactory.cs index 56bff463a..e98cd5730 100644 --- a/API.Tests/Helpers/EntityFactory.cs +++ b/API.Tests/Helpers/EntityFactory.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using API.Entities; using API.Entities.Enums; using API.Entities.Metadata; @@ -25,12 +26,14 @@ namespace API.Tests.Helpers public static Volume CreateVolume(string volumeNumber, List chapters = null) { + var chaps = chapters ?? new List(); + var pages = chaps.Count > 0 ? chaps.Max(c => c.Pages) : 0; return new Volume() { Name = volumeNumber, Number = (int) API.Parser.Parser.MinimumNumberFromRange(volumeNumber), - Pages = 0, - Chapters = chapters ?? new List() + Pages = pages, + Chapters = chaps }; } diff --git a/API.Tests/Services/ReaderServiceTests.cs b/API.Tests/Services/ReaderServiceTests.cs index 2cf796e6c..968eada19 100644 --- a/API.Tests/Services/ReaderServiceTests.cs +++ b/API.Tests/Services/ReaderServiceTests.cs @@ -1353,6 +1353,84 @@ public class ReaderServiceTests Assert.Equal("22", nextChapter.Range); + } + + [Fact] + public async Task GetContinuePoint_ShouldReturnFirstNonSpecial2() + { + _context.Series.Add(new Series() + { + Name = "Test", + Library = new Library() { + Name = "Test LIb", + Type = LibraryType.Manga, + }, + Volumes = new List() + { + // Loose chapters + EntityFactory.CreateVolume("0", new List() + { + EntityFactory.CreateChapter("45", false, new List(), 1), + EntityFactory.CreateChapter("46", false, new List(), 1), + EntityFactory.CreateChapter("47", false, new List(), 1), + EntityFactory.CreateChapter("48", false, new List(), 1), + EntityFactory.CreateChapter("Some Special Title", true, new List(), 1), + }), + + // One file volume + EntityFactory.CreateVolume("1", new List() + { + EntityFactory.CreateChapter("0", false, new List(), 1), // Read + }), + // Chapter-based volume + EntityFactory.CreateVolume("2", new List() + { + EntityFactory.CreateChapter("21", false, new List(), 1), // Read + EntityFactory.CreateChapter("22", false, new List(), 1), + }), + // Chapter-based volume + EntityFactory.CreateVolume("3", new List() + { + EntityFactory.CreateChapter("31", false, new List(), 1), + EntityFactory.CreateChapter("32", false, new List(), 1), + }), + } + }); + + _context.AppUser.Add(new AppUser() + { + UserName = "majora2007" + }); + + await _context.SaveChangesAsync(); + + var readerService = new ReaderService(_unitOfWork, Substitute.For>()); + + // Save progress on first volume and 1st chapter of second volume + await readerService.SaveReadingProgress(new ProgressDto() + { + PageNum = 1, + ChapterId = 6, // Chapter 0 volume 1 id + SeriesId = 1, + VolumeId = 2 // Volume 1 id + }, 1); + + + await readerService.SaveReadingProgress(new ProgressDto() + { + PageNum = 1, + ChapterId = 7, // Chapter 21 volume 2 id + SeriesId = 1, + VolumeId = 3 // Volume 2 id + }, 1); + + await _context.SaveChangesAsync(); + + var nextChapter = await readerService.GetContinuePoint(1, 1); + + Assert.Equal("22", nextChapter.Range); + + } [Fact] diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.html b/UI/Web/src/app/book-reader/book-reader/book-reader.component.html index b9ca69c0a..75b3fd9dc 100644 --- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.html +++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.html @@ -5,11 +5,8 @@

Book Settings - +

-
diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts index a98a78802..8953578dd 100644 --- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts +++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts @@ -782,13 +782,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy { } setPageNum(pageNum: number) { - if (pageNum < 0) { - this.pageNum = 0; - } else if (pageNum >= this.maxPages - 1) { // This case handles when we are using the pager to move to the next volume/chapter, the pageNum will get incremented past maxPages // NOTE: I made a change where I removed - 1 in comparison, it's breaking page progress - this.pageNum = this.maxPages; // - } else { - this.pageNum = pageNum; - } + this.pageNum = Math.max(Math.min(pageNum, this.maxPages), 0); } goBack() { diff --git a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts index 85f1ca6d4..dc06a525f 100644 --- a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts +++ b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts @@ -219,10 +219,10 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy { return {id: 0, title: title, promoted: false, coverImage: '', summary: '', coverImageLocked: false }; }); this.collectionTagSettings.compareFn = (options: CollectionTag[], filter: string) => { - console.log('compareFN:') - console.log('options: ', options); - console.log('filter: ', filter); - console.log('results: ', options.filter(m => this.utilityService.filter(m.title, filter))); + // console.log('compareFN:') + // console.log('options: ', options); + // console.log('filter: ', filter); + // console.log('results: ', options.filter(m => this.utilityService.filter(m.title, filter))); return options.filter(m => this.utilityService.filter(m.title, filter)); } this.collectionTagSettings.selectionCompareFn = (a: CollectionTag, b: CollectionTag) => { diff --git a/UI/Web/src/app/collections/collection-detail/collection-detail.component.html b/UI/Web/src/app/collections/collection-detail/collection-detail.component.html index da21a5396..9304abcb0 100644 --- a/UI/Web/src/app/collections/collection-detail/collection-detail.component.html +++ b/UI/Web/src/app/collections/collection-detail/collection-detail.component.html @@ -1,26 +1,18 @@ + + +

+ + {{collectionTag.title}} +

+
+
-
-

- {{collectionTag.title}} -

-
-
-
- -
-
-
- -
+

diff --git a/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts b/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts index a6cea8df2..27d302bd7 100644 --- a/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts +++ b/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts @@ -42,6 +42,9 @@ export class CollectionDetailComponent implements OnInit, OnDestroy { filterSettings: FilterSettings = new FilterSettings(); summary: string = ''; + actionInProgress: boolean = false; + + private onDestory: Subject = new Subject(); bulkActionCallback = (action: Action, data: any) => { @@ -197,6 +200,12 @@ export class CollectionDetailComponent implements OnInit, OnDestroy { } } + performAction(action: ActionItem) { + if (typeof action.callback === 'function') { + action.callback(action.action, this.collectionTag); + } + } + openEditCollectionTagModal(collectionTag: CollectionTag) { const modalRef = this.modalService.open(EditCollectionTagsComponent, { size: 'lg', scrollable: true }); modalRef.componentInstance.tag = this.collectionTag; diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.html b/UI/Web/src/app/manga-reader/manga-reader.component.html index ca6f845e6..6434fc681 100644 --- a/UI/Web/src/app/manga-reader/manga-reader.component.html +++ b/UI/Web/src/app/manga-reader/manga-reader.component.html @@ -19,7 +19,7 @@ Keyboard Shortcuts Modal - {{readerService.imageUrlToPageNum(canvasImage.src)}} - {{PageNumber + 1}} +
diff --git a/UI/Web/src/app/metadata-filter/metadata-filter.component.html b/UI/Web/src/app/metadata-filter/metadata-filter.component.html index 9e661805c..d13b87494 100644 --- a/UI/Web/src/app/metadata-filter/metadata-filter.component.html +++ b/UI/Web/src/app/metadata-filter/metadata-filter.component.html @@ -5,7 +5,7 @@
- +

Book Settings diff --git a/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html index b88a821b0..146873d67 100644 --- a/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html +++ b/UI/Web/src/app/reading-list/dragable-ordered-list/dragable-ordered-list.component.html @@ -8,7 +8,7 @@
- +

- + When you put a number in the reorder input, the item will be inserted at that location and all other items will have their order updated.

\ No newline at end of file diff --git a/UI/Web/src/app/series-detail/series-detail.component.html b/UI/Web/src/app/series-detail/series-detail.component.html index f065f8c7d..a7af84f15 100644 --- a/UI/Web/src/app/series-detail/series-detail.component.html +++ b/UI/Web/src/app/series-detail/series-detail.component.html @@ -14,7 +14,7 @@
-
+