fix(#4345): 🐛 Fixed the issue where denied requests we not appearing correctly

This commit is contained in:
tidusjar 2021-10-13 21:38:26 +01:00
commit 5a2f652a28
8 changed files with 59 additions and 26 deletions

View file

@ -75,6 +75,7 @@ namespace Ombi.Core.Rule.Rules.Search
episodeSearching.Requested = true; episodeSearching.Requested = true;
episodeSearching.Available = ep.Available; episodeSearching.Available = ep.Available;
episodeSearching.Approved = ep.Season.ChildRequest.Approved; episodeSearching.Approved = ep.Season.ChildRequest.Approved;
episodeSearching.Denied = request.Denied;
} }
} }
} }

View file

@ -30,6 +30,35 @@ namespace Ombi.Store.Entities.Requests
public List<Issues> Issues { get; set; } public List<Issues> Issues { get; set; }
public List<SeasonRequests> SeasonRequests { get; set; } public List<SeasonRequests> SeasonRequests { get; set; }
[NotMapped]
public string RequestStatus
{
get
{
if (Available)
{
return "Common.Available";
}
if (Denied ?? false)
{
return "Common.Denied";
}
if (Approved & !Available)
{
return "Common.ProcessingRequest";
}
if (!Approved && !Available)
{
return "Common.PendingApproval";
}
return string.Empty;
}
}
} }
public enum SeriesType public enum SeriesType

View file

@ -29,6 +29,8 @@ namespace Ombi.Store.Repository.Requests
public bool Available { get; set; } public bool Available { get; set; }
public bool Approved { get; set; } public bool Approved { get; set; }
public bool Requested { get; set; } public bool Requested { get; set; }
[NotMapped]
public bool? Denied { get; set; }
public int SeasonId { get; set; } public int SeasonId { get; set; }
[ForeignKey(nameof(SeasonId))] [ForeignKey(nameof(SeasonId))]
@ -46,12 +48,17 @@ namespace Ombi.Store.Repository.Requests
return "Common.Available"; return "Common.Available";
} }
if (Denied ?? false)
{
return "Common.Denied";
}
if (Approved & !Available) if (Approved & !Available)
{ {
return "Common.ProcessingRequest"; return "Common.ProcessingRequest";
} }
if (!Approved && !Available && Requested) if (!Approved && !Available)
{ {
return "Common.PendingApproval"; return "Common.PendingApproval";
} }

View file

@ -130,6 +130,7 @@ export interface IChildRequests extends IBaseRequest {
parentRequest: ITvRequests; parentRequest: ITvRequests;
subscribed: boolean; subscribed: boolean;
showSubscribe: boolean; showSubscribe: boolean;
requestStatus: string;
} }
export interface ITvUpdateModel { export interface ITvUpdateModel {
@ -168,6 +169,7 @@ export interface IEpisodesRequests {
requested: boolean; requested: boolean;
approved: boolean; approved: boolean;
requestStatus: string; requestStatus: string;
denied: boolean;
selected: boolean; // This is for the UI only selected: boolean; // This is for the UI only
} }

View file

@ -42,3 +42,8 @@
display: inline-block; display: inline-block;
background-color: #ffd740; background-color: #ffd740;
} }
.top-right.denied span:before{
display: inline-block;
background-color: #ff4040;
}

View file

@ -191,6 +191,13 @@ export class TvRequestGridComponent {
return "available"; return "available";
} }
const allDenied = season.episodes.every((ep) => {
return ep.denied;
});
if (allDenied) {
return "denied";
}
const seasonPending = season.episodes.some((ep) => { const seasonPending = season.episodes.some((ep) => {
return ep.requested && !ep.approved return ep.requested && !ep.approved
}); });
@ -212,6 +219,10 @@ export class TvRequestGridComponent {
return "available"; return "available";
} }
if (ep.denied) {
return "denied";
}
if (ep.requested && !ep.approved) { if (ep.requested && !ep.approved) {
return "requested"; return "requested";
} }

View file

@ -2,16 +2,7 @@
<mat-expansion-panel *ngFor="let request of tvRequest"> <mat-expansion-panel *ngFor="let request of tvRequest">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
<div *ngIf="request.approved && !request.available && !request.denied">{{'Common.ProcessingRequest' | translate}}</div> <div> {{ request.requestStatus | translate }}</div>
<div *ngIf="request.denied && !request.available">{{'Common.Denied' | translate}}</div>
<div *ngIf="request.requested && !request.approved && !request.available">
{{'Common.PendingApproval' | translate}}
</div>
<div *ngIf="!request.requested && !request.available && !request.approved">
{{'Common.NotRequested' | translate}}
</div>
<div *ngIf="request.available">{{'Common.Available' | translate}}
</div>
</mat-panel-title> </mat-panel-title>
<mat-panel-description> <mat-panel-description>
{{'Requests.RequestedBy' | translate}} '{{request.requestedUser.userAlias}}' on {{'Requests.RequestedBy' | translate}} '{{request.requestedUser.userAlias}}' on
@ -45,15 +36,7 @@
<ng-container matColumnDef="status"> <ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef> {{ 'Requests.GridStatus' | translate }} </th> <th mat-header-cell *matHeaderCellDef> {{ 'Requests.GridStatus' | translate }} </th>
<td mat-cell *matCellDef="let ep"> <td mat-cell *matCellDef="let ep">
<span> {{ request.requestStatus | translate }} </span>
<span *ngIf="request.denied" id="deniedLabel" [translate]="'Common.Denied'">
</span>
<span *ngIf="!request.denied && ep.available" id="availableLabel" [translate]="'Common.Available'"></span>
<span *ngIf="!request.denied && ep.approved && !ep.available" class="label label-info" id="processingRequestLabel"
[translate]="'Common.ProcessingRequest'"></span>
<div *ngIf="!request.denied && !ep.approved">
<div *ngIf="!ep.available"><span class="label label-warning" id="pendingApprovalLabel" [translate]="'Common.PendingApproval'"></span></div>
</div>
</td> </td>
</ng-container> </ng-container>

View file

@ -50,12 +50,7 @@
<ng-container matColumnDef="requestStatus"> <ng-container matColumnDef="requestStatus">
<th mat-header-cell *matHeaderCellDef> {{'Requests.RequestStatus' | translate}} </th> <th mat-header-cell *matHeaderCellDef> {{'Requests.RequestStatus' | translate}} </th>
<td mat-cell id="requestedStatus{{element.id}}" *matCellDef="let element"> <td mat-cell id="requestedStatus{{element.id}}" *matCellDef="let element"> {{element.requestStatus | translate}} </td>
<div *ngIf="element.approved && !element.available">{{'Common.ProcessingRequest' | translate}}</div>
<div *ngIf="!element.approved && !element.available">{{'Common.PendingApproval' |translate}}</div>
<div *ngIf="element.available">{{'Common.Available' | translate}}</div>
</td>
</ng-container> </ng-container>
<ng-container matColumnDef="status"> <ng-container matColumnDef="status">