diff --git a/server/src/modules/storygraph/storygraph-sync.service.test.ts b/server/src/modules/storygraph/storygraph-sync.service.test.ts index 11f35d4fd..e3fcc5e3e 100644 --- a/server/src/modules/storygraph/storygraph-sync.service.test.ts +++ b/server/src/modules/storygraph/storygraph-sync.service.test.ts @@ -312,6 +312,15 @@ describe('StorygraphSyncService', () => { await expect(makeService().syncBook(1, 1)).resolves.toBe('synced'); expect(mockMatchService.matchBook).toHaveBeenCalled(); + expect(mockClient.post).toHaveBeenCalledTimes(1); + expect(mockClient.post).toHaveBeenCalledWith( + 1, + cookies, + expect.stringContaining('/update-status.js?book_id=abc-123&status=read'), + {}, + 'csrf-token', + ); + expect(mockClient.post).not.toHaveBeenCalledWith(1, cookies, '/update-progress', expect.anything(), 'csrf-token'); }); it('skips unselected books when sync mode is selected-only', async () => { diff --git a/server/src/modules/storygraph/storygraph-sync.service.ts b/server/src/modules/storygraph/storygraph-sync.service.ts index 5b63ce1eb..a927fb18e 100644 --- a/server/src/modules/storygraph/storygraph-sync.service.ts +++ b/server/src/modules/storygraph/storygraph-sync.service.ts @@ -470,7 +470,9 @@ export class StorygraphSyncService { try { await this.updateStatus(userId, cookies, match.storygraphBookId, storygraphStatus); - if (book.progress != null) { + // StoryGraph's read transition logs the remaining pages. A subsequent progress update + // would create another journal entry for the full page count. + if (book.progress != null && storygraphStatus !== STORYGRAPH_STATUS.READ) { await this.updateProgress(userId, cookies, match.storygraphBookId, book.progress); }