mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 17:22:54 -07:00
Fix query for fetching requested tv shows
This commit is contained in:
parent
91a04f6ca7
commit
71009f4942
1 changed files with 5 additions and 3 deletions
|
@ -631,7 +631,10 @@ namespace Ombi.Core.Engine
|
|||
};
|
||||
}
|
||||
|
||||
IQueryable<RequestLog> log = _requestLog.GetAll().Where(x => x.UserId == user.Id && x.RequestType == RequestType.TvShow);
|
||||
IQueryable<RequestLog> log = _requestLog.GetAll()
|
||||
.Where(x => x.UserId == user.Id
|
||||
&& x.RequestType == RequestType.TvShow
|
||||
&& x.RequestDate >= DateTime.UtcNow.AddDays(-7));
|
||||
|
||||
// Needed, due to a bug which would cause all episode counts to be 0
|
||||
int zeroEpisodeCount = await log.Where(x => x.EpisodeCount == 0).Select(x => x.EpisodeCount).CountAsync();
|
||||
|
@ -640,8 +643,7 @@ namespace Ombi.Core.Engine
|
|||
|
||||
int count = limit - (zeroEpisodeCount + episodeCount);
|
||||
|
||||
DateTime oldestRequestedAt = await log.Where(x => x.RequestDate >= DateTime.UtcNow.AddDays(-7))
|
||||
.OrderBy(x => x.RequestDate)
|
||||
DateTime oldestRequestedAt = await log.OrderBy(x => x.RequestDate)
|
||||
.Select(x => x.RequestDate)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue