mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 03:28:28 -07:00
Do not show available, approved stuff on the vote page !wip
This commit is contained in:
parent
9cf8ea7a6f
commit
9f696bfc7d
2 changed files with 25 additions and 13 deletions
|
@ -44,6 +44,10 @@ namespace Ombi.Core.Engine
|
||||||
var musicRequestsTask = _musicRequestEngine.GetRequests();
|
var musicRequestsTask = _musicRequestEngine.GetRequests();
|
||||||
foreach (var r in movieRequests)
|
foreach (var r in movieRequests)
|
||||||
{
|
{
|
||||||
|
if (r.Available || r.Approved || (r.Denied ?? false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Make model
|
// Make model
|
||||||
var votes = GetVotes(r.Id, RequestType.Movie);
|
var votes = GetVotes(r.Id, RequestType.Movie);
|
||||||
var upVotes = await votes.Where(x => x.VoteType == VoteType.Upvote).CountAsync();
|
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)
|
foreach (var r in await musicRequestsTask)
|
||||||
{
|
{
|
||||||
|
if (r.Available || r.Approved || (r.Denied ?? false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Make model
|
// Make model
|
||||||
var votes = GetVotes(r.Id, RequestType.Album);
|
var votes = GetVotes(r.Id, RequestType.Album);
|
||||||
var upVotes = await votes.Where(x => x.VoteType == VoteType.Upvote).CountAsync();
|
var upVotes = await votes.Where(x => x.VoteType == VoteType.Upvote).CountAsync();
|
||||||
|
@ -90,6 +98,10 @@ namespace Ombi.Core.Engine
|
||||||
var finalsb = new StringBuilder();
|
var finalsb = new StringBuilder();
|
||||||
foreach (var childRequests in r.ChildRequests)
|
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))
|
foreach (var epInformation in childRequests.SeasonRequests.OrderBy(x => x.SeasonNumber))
|
||||||
{
|
{
|
||||||
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
|
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($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
|
||||||
finalsb.Append("<br />");
|
finalsb.Append("<br />");
|
||||||
}
|
}
|
||||||
|
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;
|
return vm;
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let vm of viewModel">
|
<tr *ngFor="let vm of viewModel">
|
||||||
<td class="vcenter">
|
<td class="vcenter">
|
||||||
<button class="btn btn-info-outline" (click)="upvote(vm)"><i class="fa fa-arrow-up" aria-hidden="true"></i></button>
|
<button class="btn btn-info-outline" (click)="upvote(vm)"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i></button>
|
||||||
<button class="btn btn-info-outline" (click)="downvote(vm)"><i class="fa fa-arrow-down" aria-hidden="true"></i></button>
|
<button class="btn btn-info-outline" (click)="downvote(vm)"><i class="fa fa-thumbs-o-down" aria-hidden="true"></i></button>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 10%"> <img *ngIf="vm.image" class="img-responsive poster" style="max-width: 100%;
|
<td style="width: 10%"> <img *ngIf="vm.image" class="img-responsive poster" style="max-width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue