pull/1425/head
tidusjar 7 years ago
parent 40fb27ebab
commit a278917dcd

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
using AutoMapper;
using Hangfire;
using Ombi.Api.TvMaze;
using Ombi.Core.Models.Requests;
@ -17,13 +18,15 @@ namespace Ombi.Core.Engine
{
public class TvRequestEngine : BaseMediaEngine, ITvRequestEngine
{
public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, INotificationService notificationService) : base(user, requestService)
public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, INotificationService notificationService, IMapper map) : base(user, requestService)
{
TvApi = tvApi;
NotificationService = notificationService;
Mapper = map;
}
private INotificationService NotificationService { get; }
private ITvMazeApi TvApi { get; }
private IMapper Mapper { get; }
public async Task<RequestEngineResult> RequestTvShow(SearchTvShowViewModel tv)
{
@ -166,6 +169,16 @@ namespace Ombi.Core.Engine
newRequest.SeasonRequests = episodeDifference;
}
if (!existingRequest.HasChildRequests)
{
// So this is the first child request, we will want to convert the original request to a child
var originalRequest = Mapper.Map<TvRequestModel>(existingRequest);
existingRequest.ChildRequests.Add(originalRequest);
existingRequest.RequestedUsers.Clear();
existingRequest.Approved = false;
existingRequest.Available = false;
}
existingRequest.ChildRequests.Add(newRequest);
TvRequestService.UpdateRequest(existingRequest);

@ -1,4 +1,4 @@
<p-growl [value]="notificationService.messages" [life]="1000"></p-growl>
<p-growl [value]="notificationService.messages" ></p-growl>
<nav *ngIf="showNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">

@ -2,7 +2,7 @@
export interface ISearchTvResult {
id: number,
title: string,
title: string, // used in the request
aliases: string[],
banner: string,
seriesId: number,

@ -32,7 +32,7 @@
<span>Status: </span>
<span class="label label-success">{{request.status}}</span>
</div>
<div *ngIf="!request.hasChildRequests">
<div>
<span>Request status: </span>
<span *ngIf="request.available" class="label label-success">Available</span>
@ -75,16 +75,19 @@
{{/if_eq}}
</div>-->
</div>
<!--Child Requests-->
<div *ngIf="request.hasChildRequests">
<button type="button" class="btn btn-sm btn-info-outline" data-toggle="collapse" [attr.data-target]="'#' + request.id +'childRequests'">Children</button>
<div id="{{request.id}}childRequests" class="collapse">
<div *ngFor="let child of request.childRequests">
<hr/>
<div *ngIf="request.requestedUsers">Requested By: <span *ngFor="let user of request.requestedUsers">{{user}} </span></div>
<div>Seasons Requested: <span *ngFor="let s of request.seasonNumbersRequested">{{s}} </span> </div>
<div *ngIf="request.requestedUsers">Requested By: <span *ngFor="let user of request.requestedUsers">{{user}} </span>
</div>
<div>Seasons Requested: <span *ngFor="let s of request.seasonNumbersRequested">{{s}} </span>
</div>
<div>
<span>Request status: </span>
<span *ngIf="request.available" class="label label-success">Available</span>

@ -53,7 +53,7 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
this.result = x as IRequestEngineResult;
if (this.result.requestAdded) {
this.notificationService.success("Request Added",
`Request for ${this.series.seriesName} has been added successfully`);
`Request for ${this.series.title} has been added successfully`);
} else {
this.notificationService.warning("Request Added", this.result.message);
}

@ -44,7 +44,7 @@
<div>
<a href="http://www.imdb.com/title/{{result.imdbId}}/" target="_blank">
<h4>{{result.seriesName}} ({{result.firstAired}})</h4>
<h4>{{result.title}} ({{result.firstAired}})</h4>
</a>

@ -13,10 +13,12 @@ import { NotificationService } from '../services/notification.service';
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
import template from './tvsearch.component.html';
@Component({
selector: 'tv-search',
moduleId: module.id,
templateUrl: './tvsearch.component.html',
template: template,
})
export class TvSearchComponent implements OnInit, OnDestroy {

Loading…
Cancel
Save