this should fix some issues with the episode requests #514

pull/535/head
tidusjar 8 years ago
parent 808134599a
commit 8cae79ecc7

@ -260,9 +260,22 @@ namespace PlexRequests.UI.Helpers
var internalEpisodeIds = new List<int>(); var internalEpisodeIds = new List<int>();
var tasks = new List<Task>(); var tasks = new List<Task>();
var requestedEpisodes = model.Episodes;
foreach (var r in episodes) foreach (var r in episodes)
{ {
if (r.hasFile || !model.SeasonList.Contains(r.seasonNumber)) // If it already has the file, there is no point in updating it if (r.hasFile) // If it already has the file, there is no point in updating it
{
continue;
}
var epComparison = new EpisodesModel
{
EpisodeNumber = r.episodeNumber,
SeasonNumber = r.seasonNumber
};
// Make sure we are looking for the right episode and season
if (!requestedEpisodes.Contains(epComparison))
{ {
continue; continue;
} }

@ -369,7 +369,7 @@ namespace PlexRequests.UI.Modules
viewT.Requested = true; viewT.Requested = true;
} }
} }
viewTv.Add(viewT); viewTv.Add(viewT);
} }
@ -657,7 +657,11 @@ namespace PlexRequests.UI.Modules
return await AddUserToRequest(existingRequest, settings, fullShowName, true); return await AddUserToRequest(existingRequest, settings, fullShowName, true);
} }
// We have an episode that has not yet been requested, let's continue else
{
// We no episodes to approve
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"{fullShowName} {Resources.UI.Search_AlreadyInPlex}" });
}
} }
else if (model.SeasonList.Except(existingRequest.SeasonList).Any()) else if (model.SeasonList.Except(existingRequest.SeasonList).Any())
{ {
@ -765,7 +769,7 @@ namespace PlexRequests.UI.Modules
UpdateRequest(existingRequest, settings, UpdateRequest(existingRequest, settings,
$"{fullShowName} {Resources.UI.Search_SuccessfullyAdded}"); $"{fullShowName} {Resources.UI.Search_SuccessfullyAdded}");
} }
return await UpdateRequest(existingRequest, settings, $"{fullShowName} {Resources.UI.Search_AlreadyRequested}"); return await UpdateRequest(existingRequest, settings, $"{fullShowName} {Resources.UI.Search_AlreadyRequested}");
} }
@ -1033,7 +1037,8 @@ namespace PlexRequests.UI.Modules
Name = ep.name, Name = ep.name,
EpisodeId = ep.id EpisodeId = ep.id
}); });
}return model; }
return model;
} }

Loading…
Cancel
Save