#1513 partially fixed a bug

pull/1529/head
tidusjar 7 years ago
parent 9e6a7d5a72
commit d8e77ef6b3

@ -128,13 +128,21 @@ namespace Ombi.Core.Engine
public async Task<IEnumerable<TvRequests>> GetRequests(int count, int position)
{
var allRequests = await TvRepository.Get().Skip(position).Take(count).ToListAsync();
var allRequests = await TvRepository.Get()
.Include(x => x.ChildRequests)
.ThenInclude(x => x.SeasonRequests)
.ThenInclude(x => x.Episodes)
.Skip(position).Take(count).ToListAsync();
return allRequests;
}
public async Task<IEnumerable<TreeNode<TvRequests, List<ChildRequests>>>> GetRequestsTreeNode(int count, int position)
{
var allRequests = await TvRepository.Get().Skip(position).Take(count).ToListAsync();
var allRequests = await TvRepository.Get()
.Include(x => x.ChildRequests)
.ThenInclude(x => x.SeasonRequests)
.ThenInclude(x=>x.Episodes)
.Skip(position).Take(count).ToListAsync();
return ParseIntoTreeNode(allRequests);
}
@ -146,7 +154,7 @@ namespace Ombi.Core.Engine
public async Task<IEnumerable<ChildRequests>> GetAllChldren(int tvId)
{
return await TvRepository.GetChild().Where(x => x.ParentRequestId == tvId).ToListAsync();
return await TvRepository.GetChild().Include(x => x.SeasonRequests).Where(x => x.ParentRequestId == tvId).ToListAsync();
}
public async Task<IEnumerable<TvRequests>> SearchTvRequest(string search)

@ -111,7 +111,7 @@ namespace Ombi.Core.Senders
{
foreach (var ep in req.Episodes)
{
var sonarrEp = sonarrEpisodes.FirstOrDefault(x => x.episodeNumber == ep.EpisodeNumber && x.seasonNumber == ep.Season.SeasonNumber);
var sonarrEp = sonarrEpisodes.FirstOrDefault(x => x.episodeNumber == ep.EpisodeNumber && x.seasonNumber == req.SeasonNumber);
if (sonarrEp != null)
{
sonarrEp.monitored = true;

@ -99,6 +99,7 @@ namespace Ombi.Store.Repository.Requests
public async Task UpdateChild(ChildRequests request)
{
Db.Attach(request).State = EntityState.Modified;
Db.Attach(request.SeasonRequests).State = EntityState.Modified;
await Db.SaveChangesAsync();
}

Loading…
Cancel
Save