mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext.
This commit is contained in:
parent
876466d05b
commit
1f5d1eca1d
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -19,14 +20,16 @@ namespace API.Controllers
|
|||||||
private readonly ICacheService _cacheService;
|
private readonly ICacheService _cacheService;
|
||||||
private readonly ILogger<ReaderController> _logger;
|
private readonly ILogger<ReaderController> _logger;
|
||||||
private readonly IUnitOfWork _unitOfWork;
|
private readonly IUnitOfWork _unitOfWork;
|
||||||
|
private readonly DataContext _dataContext;
|
||||||
|
|
||||||
public ReaderController(IDirectoryService directoryService, ICacheService cacheService,
|
public ReaderController(IDirectoryService directoryService, ICacheService cacheService,
|
||||||
ILogger<ReaderController> logger, IUnitOfWork unitOfWork)
|
ILogger<ReaderController> logger, IUnitOfWork unitOfWork, DataContext dataContext)
|
||||||
{
|
{
|
||||||
_directoryService = directoryService;
|
_directoryService = directoryService;
|
||||||
_cacheService = cacheService;
|
_cacheService = cacheService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_unitOfWork = unitOfWork;
|
_unitOfWork = unitOfWork;
|
||||||
|
_dataContext = dataContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("image")]
|
[HttpGet("image")]
|
||||||
@ -218,7 +221,8 @@ namespace API.Controllers
|
|||||||
PagesRead = bookmarkDto.PageNum,
|
PagesRead = bookmarkDto.PageNum,
|
||||||
VolumeId = bookmarkDto.VolumeId,
|
VolumeId = bookmarkDto.VolumeId,
|
||||||
SeriesId = bookmarkDto.SeriesId,
|
SeriesId = bookmarkDto.SeriesId,
|
||||||
ChapterId = bookmarkDto.ChapterId
|
ChapterId = bookmarkDto.ChapterId,
|
||||||
|
LastModified = DateTime.Now
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -226,8 +230,9 @@ namespace API.Controllers
|
|||||||
userProgress.PagesRead = bookmarkDto.PageNum;
|
userProgress.PagesRead = bookmarkDto.PageNum;
|
||||||
userProgress.SeriesId = bookmarkDto.SeriesId;
|
userProgress.SeriesId = bookmarkDto.SeriesId;
|
||||||
userProgress.VolumeId = bookmarkDto.VolumeId;
|
userProgress.VolumeId = bookmarkDto.VolumeId;
|
||||||
|
userProgress.LastModified = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
_unitOfWork.UserRepository.Update(user);
|
_unitOfWork.UserRepository.Update(user);
|
||||||
|
|
||||||
if (await _unitOfWork.Complete())
|
if (await _unitOfWork.Complete())
|
||||||
|
@ -315,13 +315,13 @@ namespace API.Data
|
|||||||
&& s.PagesRead > 0
|
&& s.PagesRead > 0
|
||||||
&& s.PagesRead < s.Series.Pages
|
&& s.PagesRead < s.Series.Pages
|
||||||
&& (libraryId <= 0 || s.Series.LibraryId == libraryId))
|
&& (libraryId <= 0 || s.Series.LibraryId == libraryId))
|
||||||
|
.OrderByDescending(s => s.LastModified)
|
||||||
|
.Take(limit)
|
||||||
.Select(s => s.Series.Id);
|
.Select(s => s.Series.Id);
|
||||||
|
|
||||||
|
|
||||||
var series = await _context.Series
|
var series = await _context.Series
|
||||||
.Where(s => seriesWithProgress.Contains(s.Id))
|
.Where(s => seriesWithProgress.Contains(s.Id))
|
||||||
.OrderByDescending(s => s.LastModified)
|
|
||||||
.Take(limit)
|
|
||||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user