Skip to content

Commit

Permalink
fix(4K) :4K request fixes (#4702)
Browse files Browse the repository at this point in the history
* GetRequestsByStatus wasn't implementing the MovieRequests object correctly for 4K quality requests with the ProcessingRequest status.

* Fixed 4K requests not getting automatically approved if the user has the "Auto Approve Movie" role flag enabled.

* Fixed "Request Date" values for the "left-panel-details" div class. Previously when the movie was exclusively 4K (regular request was absent), then "Request Date" equaled DateTime.MinValue (January 1, 0001).

* Fixed "Request Status" evaluation in the "left-panel-details" div class. Now it shows the appropriate status instead of an empty spot. "Request Status" displays both regular and 4K statuses at the same time if needed. Added a comma to the end of the "RequestStatus" label to maintain design consistency with the other labels. Also added a "Denied Reason" element for 4K  requests.
  • Loading branch information
Lucane authored Jul 28, 2022
1 parent 875da95 commit 7fd9178
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,4 @@ _Pvt_Extensions
/src/Ombi/databases.json
/src/Ombi/healthchecksdb
/src/Ombi/ClientApp/package-lock.json
/src/Ombi.Core/Properties/launchSettings.json
7 changes: 4 additions & 3 deletions src/Ombi.Core/Engine/MovieRequestEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public async Task<RequestEngineResult> RequestMovie(MovieRequestViewModel model)
Status = movieInfo.Status,
RequestedDate = model.Is4kRequest ? DateTime.MinValue : DateTime.Now,
Approved = false,
Approved4K = false,
RequestedUserId = canRequestOnBehalf ? model.RequestOnBehalf : userDetails.Id,
Background = movieInfo.BackdropPath,
LangCode = model.LanguageCode,
Expand All @@ -151,7 +152,7 @@ public async Task<RequestEngineResult> RequestMovie(MovieRequestViewModel model)
var usDates = movieInfo.ReleaseDates?.Results?.FirstOrDefault(x => x.IsoCode == "US");
requestModel.DigitalReleaseDate = usDates?.ReleaseDate
?.FirstOrDefault(x => x.Type == ReleaseDateType.Digital)?.ReleaseDate;

var ruleResults = (await RunRequestRules(requestModel)).ToList();
var ruleResultInError = ruleResults.Find(x => !x.Success);
if (ruleResultInError != null)
Expand All @@ -163,7 +164,7 @@ public async Task<RequestEngineResult> RequestMovie(MovieRequestViewModel model)
};
}

if (requestModel.Approved) // The rules have auto approved this
if (requestModel.Approved || requestModel.Approved4K) // The rules have auto approved this
{
var requestEngineResult = await AddMovieRequest(requestModel, fullMovieName, model.RequestOnBehalf, isExisting, is4kRequest);
if (requestEngineResult.Result)
Expand Down Expand Up @@ -333,7 +334,7 @@ public async Task<RequestsViewModel<MovieRequests>> GetRequestsByStatus(int coun
allRequests = allRequests.Where(x =>
(x.RequestedDate != DateTime.MinValue && x.Approved && !x.Available && (!x.Denied.HasValue || !x.Denied.Value))
||
(x.Has4KRequest && x.Approved4K && !x.Available && (!x.Denied.HasValue || !x.Denied.Value))
(x.Has4KRequest && x.Approved4K && !x.Available4K && (!x.Denied4K.HasValue || !x.Denied4K.Value))
);
break;
case RequestStatus.Available:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,50 @@
<span id="status"> {{ this.movie.status | translateStatus }}</span>
</div>
<div>
<span class="label">{{'MediaDetails.Availability' | translate }}</span>
<span *ngIf="movie.available"> {{'Common.Available' | translate}}</span>
<span *ngIf="!movie.available"> {{'Common.NotAvailable' | translate}}</span>
</div>
<div *ngIf="!movie.available">
<span class="label">{{'MediaDetails.RequestStatus' | translate }}</span>
<div *ngIf="movie.denied">{{'Common.Denied' | translate}}</div>
<div *ngElseIf="movie.approved && !movie.available">{{'Common.ProcessingRequest' | translate}}</div>
<div *ngElseIf="movie.requested && !movie.approved && !movie.available">{{'Common.PendingApproval' | translate}}
</div>
<div *ngElseIf="!movie.requested && !movie.available && !movie.approved">{{'Common.NotRequested' | translate}}
</div>
<span class="label">{{'MediaDetails.Availability' | translate }}</span>
<span *ngIf="movie.available || movie.available4K"> {{'Common.Available' | translate}}</span>
<span *ngIf="!movie.available && !movie.available4K"> {{'Common.NotAvailable' | translate}}</span>
</div>
<div *ngIf="(!movie.available && movie.requested) || (!movie.available4K && movie.has4KRequest)">
<span class="label">{{'MediaDetails.RequestStatus' | translate }}</span>
<div *ngIf="!movie.available && movie.requested">
<div *ngIf="movie.denied">{{'Common.RequestDenied' | translate}}</div>
<div *ngIf="movie.approved && !movie.available">{{'Common.ProcessingRequest' | translate}}</div>
<div *ngIf="movie.requested && !movie.approved">{{'Common.PendingApproval' | translate}}</div>
<!--<div *ngIf="!movie.requested && !movie.available && !movie.approved">{{'Common.NotRequested' | translate}}</div>-->
</div>
<div *ngIf="!movie.available4K && movie.has4KRequest">
<div *ngIf="movie.denied4K">{{'Common.RequestDenied4K' | translate}}</div>
<div *ngIf="movie.approved4K && !movie.available4K">{{'Common.ProcessingRequest4K' | translate}}</div>
<div *ngIf="movie.requested4K && !movie.approved4K && !movie.available4K">{{'Common.PendingApproval4K' | translate}}</div>
<!--<div *ngIf="!movie.requested4K && !movie.available4K && !movie.approved4K">{{'Common.NotRequested4K' | translate}}</div>-->
</div>
</div>

<div *ngIf="request">
<span class="label">{{'MediaDetails.RequestedBy' | translate }}</span>
<span id="requestedByInfo"> {{request.requestedUser.userAlias}}</span>
<span class="label">{{'MediaDetails.RequestedBy' | translate }}</span>
<span id="requestedByInfo"> {{request.requestedUser.userAlias}}</span>
</div>

<div *ngIf="request">
<span class="label">{{'MediaDetails.RequestDate' | translate }}</span>
{{request.requestedDate | amUserLocale | amDateFormat: 'LL'}}
<span class="label">{{'MediaDetails.RequestDate' | translate }}</span>
<span *ngIf="request.requestedDate < request.requestedDate4k"> {{request.requestedDate4k | amUserLocale | amDateFormat: 'LL'}}</span>
<span *ngIf="request.requestedDate > request.requestedDate4k"> {{request.requestedDate | amUserLocale | amDateFormat: 'LL'}}</span>
</div>

<div *ngIf="request && request.source !== RequestSource.Ombi">
<span class="label">{{'MediaDetails.RequestSource' | translate }}</span>
{{RequestSource[request.source]}}
</div>

<div *ngIf="request && request.denied">
<span class="label">{{'MediaDetails.DeniedReason' | translate }}</span>
<div *ngIf="request">
<span class="label">{{'MediaDetails.DeniedReason' | translate }}</span>
<div *ngIf="request.denied">
<span id="deniedReasonInfo">{{request.deniedReason}}</span>
</div>
<div *ngIf="request.denied4K">
<span id="deniedReasonInfo4K">{{request.deniedReason4K}}</span>
</div>
</div>


Expand All @@ -72,7 +84,7 @@

<div *ngIf="movie.available4K">
<span class="label">{{'MediaDetails.Quality' | translate }}&nbsp;</span>
<span >{{"4K" | quality}}</span>
<span>{{"4K" | quality}}</span>
</div>

<div *ngIf="advancedOptions && request && request.rootPathOverrideTitle">
Expand Down
68 changes: 36 additions & 32 deletions src/Ombi/wwwroot/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,41 @@
}
},
"Common": {
"ContinueButton": "Continue",
"Available": "Available",
"Available4K": "Available 4K",
"Approved": "Approved",
"Approve4K": "Approve 4K",
"Pending": "Pending",
"PartiallyAvailable": "Partially Available",
"Monitored": "Monitored",
"NotAvailable": "Not Available",
"ProcessingRequest": "Processing Request",
"PendingApproval": "Pending Approval",
"RequestDenied": "Request Denied",
"NotRequested": "Not Requested",
"Requested": "Requested",
"Requested4K": "Requested 4K",
"Search":"Search",
"Request": "Request",
"Request4K": "Request 4K",
"Denied": "Denied",
"Approve": "Approve",
"PartlyAvailable": "Partly Available",
"ViewDetails": "View Details",
"Errors": {
"Validation": "Please check your entered values"
},
"Cancel": "Cancel",
"Submit": "Submit",
"Update": "Update",
"tvShow": "TV Show",
"movie": "Movie",
"album": "Album"
"ContinueButton": "Continue",
"Available": "Available",
"Available4K": "Available 4K",
"Approved": "Approved",
"Approve4K": "Approve 4K",
"Pending": "Pending",
"PartiallyAvailable": "Partially Available",
"Monitored": "Monitored",
"NotAvailable": "Not Available",
"ProcessingRequest": "Processing Request",
"ProcessingRequest4K": "Processing Request 4K",
"PendingApproval": "Pending Approval",
"PendingApproval4K": "Pending Approval 4K",
"RequestDenied": "Request Denied",
"RequestDenied4K": "Request Denied 4K",
"NotRequested": "Not Requested",
"NotRequested4K": "Not Requested 4K",
"Requested": "Requested",
"Requested4K": "Requested 4K",
"Search": "Search",
"Request": "Request",
"Request4K": "Request 4K",
"Denied": "Denied",
"Approve": "Approve",
"PartlyAvailable": "Partly Available",
"ViewDetails": "View Details",
"Errors": {
"Validation": "Please check your entered values"
},
"Cancel": "Cancel",
"Submit": "Submit",
"Update": "Update",
"tvShow": "TV Show",
"movie": "Movie",
"album": "Album"
},
"PasswordReset": {
"EmailAddressPlaceholder": "Email Address",
Expand Down Expand Up @@ -341,7 +345,7 @@
"Seasons": "Seasons:",
"Episodes": "Episodes:",
"Availability":"Availability:",
"RequestStatus":"Request Status",
"RequestStatus":"Request Status:",
"Quality":"Quality:",
"RootFolderOverride":"Root Folder Override:",
"QualityOverride":"Quality Override:",
Expand Down

0 comments on commit 7fd9178

Please sign in to comment.