We now have infinite scroll!

Also fixed some more unit tests
This commit is contained in:
tidusjar 2019-04-17 17:19:06 +01:00
parent 4e0459eef0
commit 961ba4297a
11 changed files with 162 additions and 68 deletions

View file

@ -21,6 +21,7 @@ using Ombi.Core.Authentication;
using Ombi.Helpers;
using Ombi.Settings.Settings.Models;
using Ombi.Store.Entities;
using TraktApiSharp.Objects.Get.Shows;
namespace Ombi.Core.Engine
{
@ -127,6 +128,19 @@ namespace Ombi.Core.Engine
return processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Popular(int currentlyLoaded, int amountToLoad)
{
var pages = PaginationHelper.GetNextPages(currentlyLoaded, amountToLoad, ResultLimit);
var results = new List<TraktShow>();
foreach (var pagesToLoad in pages)
{
var apiResult = await TraktApi.GetPopularShows(pagesToLoad.Page, ResultLimit);
results.AddRange(apiResult.Skip(pagesToLoad.Skip).Take(pagesToLoad.Take));
}
var processed = ProcessResults(results);
return processed;
}
public async Task<IEnumerable<SearchTvShowViewModel>> Anticipated()
{