Fixed: Repaired Cutoff Unmet UI and added Cutoff Unmet status badge to History.

This commit is contained in:
Taloth Saldono
2014-08-27 02:25:35 +02:00
parent 0870afb425
commit 64ecaf5f6e
12 changed files with 130 additions and 60 deletions

View File

@@ -2,6 +2,7 @@
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.History;
@@ -10,17 +11,35 @@ namespace NzbDrone.Api.History
public class HistoryModule : NzbDroneRestModule<HistoryResource>
{
private readonly IHistoryService _historyService;
private readonly IQualityUpgradableSpecification _qualityUpgradableSpecification;
private readonly IDownloadTrackingService _downloadTrackingService;
public HistoryModule(IHistoryService historyService, IDownloadTrackingService downloadTrackingService)
public HistoryModule(IHistoryService historyService,
IQualityUpgradableSpecification qualityUpgradableSpecification,
IDownloadTrackingService downloadTrackingService)
{
_historyService = historyService;
_qualityUpgradableSpecification = qualityUpgradableSpecification;
_downloadTrackingService = downloadTrackingService;
GetResourcePaged = GetHistory;
Post["/failed"] = x => MarkAsFailed();
}
protected override HistoryResource ToResource<TModel>(TModel model)
{
var resource = base.ToResource<TModel>(model);
var history = model as NzbDrone.Core.History.History;
if (history != null && history.Series != null)
{
resource.QualityCutoffNotMet = _qualityUpgradableSpecification.CutoffNotMet(history.Series.Profile.Value, history.Quality);
}
return resource;
}
private PagingResource<HistoryResource> GetHistory(PagingResource<HistoryResource> pagingResource)
{
var episodeId = Request.Query.EpisodeId;