From 9f696bfc7d3358135d12fdfa903091ccca2dede5 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Wed, 3 Oct 2018 15:03:41 +0100 Subject: [PATCH] Do not show available, approved stuff on the vote page !wip --- src/Ombi.Core/Engine/VoteEngine.cs | 34 +++++++++++++------ .../ClientApp/app/vote/vote.component.html | 4 +-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/Ombi.Core/Engine/VoteEngine.cs b/src/Ombi.Core/Engine/VoteEngine.cs index ced3b8f53..6f399f45b 100644 --- a/src/Ombi.Core/Engine/VoteEngine.cs +++ b/src/Ombi.Core/Engine/VoteEngine.cs @@ -44,6 +44,10 @@ namespace Ombi.Core.Engine var musicRequestsTask = _musicRequestEngine.GetRequests(); foreach (var r in movieRequests) { + if (r.Available || r.Approved || (r.Denied ?? false)) + { + continue; + } // Make model var votes = GetVotes(r.Id, RequestType.Movie); var upVotes = await votes.Where(x => x.VoteType == VoteType.Upvote).CountAsync(); @@ -63,6 +67,10 @@ namespace Ombi.Core.Engine foreach (var r in await musicRequestsTask) { + if (r.Available || r.Approved || (r.Denied ?? false)) + { + continue; + } // Make model var votes = GetVotes(r.Id, RequestType.Album); var upVotes = await votes.Where(x => x.VoteType == VoteType.Upvote).CountAsync(); @@ -90,6 +98,10 @@ namespace Ombi.Core.Engine var finalsb = new StringBuilder(); foreach (var childRequests in r.ChildRequests) { + if (childRequests.Available || childRequests.Approved || (childRequests.Denied ?? false)) + { + continue; + } foreach (var epInformation in childRequests.SeasonRequests.OrderBy(x => x.SeasonNumber)) { var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList(); @@ -97,18 +109,18 @@ namespace Ombi.Core.Engine finalsb.Append($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}"); finalsb.Append("
"); } + vm.Add(new VoteViewModel + { + Upvotes = upVotes, + Downvotes = downVotes, + RequestId = childRequests.Id, + RequestType = RequestType.TvShow, + Title = r.Title, + Image = r.PosterPath, + Background = r.Background, + Description = finalsb.ToString() + }); } - vm.Add(new VoteViewModel - { - Upvotes = upVotes, - Downvotes = downVotes, - RequestId = r.Id, - RequestType = RequestType.TvShow, - Title = r.Title, - Image = r.PosterPath, - Background = r.Background, - Description = finalsb.ToString() - }); } return vm; diff --git a/src/Ombi/ClientApp/app/vote/vote.component.html b/src/Ombi/ClientApp/app/vote/vote.component.html index eaeb3ca5e..4f322352d 100644 --- a/src/Ombi/ClientApp/app/vote/vote.component.html +++ b/src/Ombi/ClientApp/app/vote/vote.component.html @@ -14,8 +14,8 @@ - - + +