mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Fix for #2409
This commit is contained in:
parent
e5d09d4794
commit
6a62f3b3f3
1 changed files with 19 additions and 9 deletions
|
@ -171,24 +171,30 @@ namespace Ombi.Core.Engine
|
||||||
public async Task<RequestsViewModel<TvRequests>> GetRequestsLite(int count, int position, OrderFilterModel type)
|
public async Task<RequestsViewModel<TvRequests>> GetRequestsLite(int count, int position, OrderFilterModel type)
|
||||||
{
|
{
|
||||||
var shouldHide = await HideFromOtherUsers();
|
var shouldHide = await HideFromOtherUsers();
|
||||||
List<TvRequests> allRequests;
|
List<TvRequests> allRequests = null;
|
||||||
if (shouldHide.Hide)
|
if (shouldHide.Hide)
|
||||||
{
|
{
|
||||||
allRequests = await TvRepository.GetLite(shouldHide.UserId)
|
var tv = TvRepository.GetLite(shouldHide.UserId);
|
||||||
.OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate))
|
if (tv.Any() && tv.Select(x => x.ChildRequests).Any())
|
||||||
.Skip(position).Take(count).ToListAsync();
|
{
|
||||||
|
allRequests = await tv.OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate)).Skip(position).Take(count).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out children
|
// Filter out children
|
||||||
|
|
||||||
FilterChildren(allRequests, shouldHide);
|
FilterChildren(allRequests, shouldHide);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allRequests = await TvRepository.GetLite()
|
var tv = TvRepository.GetLite();
|
||||||
.OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate))
|
if (tv.Any() && tv.Select(x => x.ChildRequests).Any())
|
||||||
.Skip(position).Take(count).ToListAsync();
|
{
|
||||||
|
allRequests = await tv.OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate)).Skip(position).Take(count).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allRequests == null)
|
||||||
|
{
|
||||||
|
return new RequestsViewModel<TvRequests>();
|
||||||
}
|
}
|
||||||
|
|
||||||
allRequests.ForEach(async r => { await CheckForSubscription(shouldHide, r); });
|
allRequests.ForEach(async r => { await CheckForSubscription(shouldHide, r); });
|
||||||
|
|
||||||
return new RequestsViewModel<TvRequests>
|
return new RequestsViewModel<TvRequests>
|
||||||
|
@ -288,6 +294,10 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
private static void FilterChildren(IEnumerable<TvRequests> allRequests, HideResult shouldHide)
|
private static void FilterChildren(IEnumerable<TvRequests> allRequests, HideResult shouldHide)
|
||||||
{
|
{
|
||||||
|
if (allRequests == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Filter out children
|
// Filter out children
|
||||||
foreach (var t in allRequests)
|
foreach (var t in allRequests)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue