mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 00:32:57 -07:00
#1513 partially fixed a bug
This commit is contained in:
parent
9e6a7d5a72
commit
d8e77ef6b3
3 changed files with 13 additions and 4 deletions
|
@ -128,13 +128,21 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
public async Task<IEnumerable<TvRequests>> GetRequests(int count, int position)
|
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;
|
return allRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<TreeNode<TvRequests, List<ChildRequests>>>> GetRequestsTreeNode(int count, int position)
|
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);
|
return ParseIntoTreeNode(allRequests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +154,7 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
public async Task<IEnumerable<ChildRequests>> GetAllChldren(int tvId)
|
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)
|
public async Task<IEnumerable<TvRequests>> SearchTvRequest(string search)
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace Ombi.Core.Senders
|
||||||
{
|
{
|
||||||
foreach (var ep in req.Episodes)
|
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)
|
if (sonarrEp != null)
|
||||||
{
|
{
|
||||||
sonarrEp.monitored = true;
|
sonarrEp.monitored = true;
|
||||||
|
|
|
@ -99,6 +99,7 @@ namespace Ombi.Store.Repository.Requests
|
||||||
public async Task UpdateChild(ChildRequests request)
|
public async Task UpdateChild(ChildRequests request)
|
||||||
{
|
{
|
||||||
Db.Attach(request).State = EntityState.Modified;
|
Db.Attach(request).State = EntityState.Modified;
|
||||||
|
Db.Attach(request.SeasonRequests).State = EntityState.Modified;
|
||||||
|
|
||||||
await Db.SaveChangesAsync();
|
await Db.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue