Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext.

Joseph Milazzo1f5d1eca1d7b
diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.cs
index d157980ad..b2eb50ee1 100644
--- a/API/Controllers/ReaderController.cs
+++ b/API/Controllers/ReaderController.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -19,14 +20,16 @@ namespace API.Controllers
private readonly ICacheService _cacheService;
private readonly ILogger<ReaderController> _logger;
private readonly IUnitOfWork _unitOfWork;
+ private readonly DataContext _dataContext;
public ReaderController(IDirectoryService directoryService, ICacheService cacheService,
- ILogger<ReaderController> logger, IUnitOfWork unitOfWork)
+ ILogger<ReaderController> logger, IUnitOfWork unitOfWork, DataContext dataContext)
{
_directoryService = directoryService;
_cacheService = cacheService;
_logger = logger;
_unitOfWork = unitOfWork;
+ _dataContext = dataContext;
}
[HttpGet("image")]
@@ -218,7 +221,8 @@ namespace API.Controllers
PagesRead = bookmarkDto.PageNum,
VolumeId = bookmarkDto.VolumeId,
SeriesId = bookmarkDto.SeriesId,
- ChapterId = bookmarkDto.ChapterId
+ ChapterId = bookmarkDto.ChapterId,
+ LastModified = DateTime.Now
});
}
else
@@ -226,8 +230,9 @@ namespace API.Controllers
userProgress.PagesRead = bookmarkDto.PageNum;
userProgress.SeriesId = bookmarkDto.SeriesId;
userProgress.VolumeId = bookmarkDto.VolumeId;
+ userProgress.LastModified = DateTime.Now;
}
-
+
_unitOfWork.UserRepository.Update(user);
if (await _unitOfWork.Complete())
diff --git a/API/Data/SeriesRepository.cs b/API/Data/SeriesRepository.cs
index b9bae9773..7124f0932 100644
--- a/API/Data/SeriesRepository.cs
+++ b/API/Data/SeriesRepository.cs
@@ -315,13 +315,13 @@ namespace API.Data
&& s.PagesRead > 0
&& s.PagesRead < s.Series.Pages
&& (libraryId <= 0 || s.Series.LibraryId == libraryId))
+ .OrderByDescending(s => s.LastModified)
+ .Take(limit)
.Select(s => s.Series.Id);
var series = await _context.Series
.Where(s => seriesWithProgress.Contains(s.Id))
- .OrderByDescending(s => s.LastModified)
- .Take(limit)
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
.AsNoTracking()
.ToListAsync();