1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed tooltip for pending queue items.

This commit is contained in:
Taloth Saldono 2015-02-22 22:09:06 +01:00
parent a3d649452f
commit 2da23ae230
3 changed files with 23 additions and 3 deletions

View File

@ -7,6 +7,7 @@
using NzbDrone.Core.Configuration;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
@ -38,6 +39,7 @@ public class PendingReleaseService : IPendingReleaseService,
private readonly ISeriesService _seriesService;
private readonly IParsingService _parsingService;
private readonly IDelayProfileService _delayProfileService;
private readonly ITaskManager _taskManager;
private readonly IConfigService _configService;
private readonly IEventAggregator _eventAggregator;
private readonly Logger _logger;
@ -46,6 +48,7 @@ public PendingReleaseService(IPendingReleaseRepository repository,
ISeriesService seriesService,
IParsingService parsingService,
IDelayProfileService delayProfileService,
ITaskManager taskManager,
IConfigService configService,
IEventAggregator eventAggregator,
Logger logger)
@ -54,6 +57,7 @@ public PendingReleaseService(IPendingReleaseRepository repository,
_seriesService = seriesService;
_parsingService = parsingService;
_delayProfileService = delayProfileService;
_taskManager = taskManager;
_configService = configService;
_eventAggregator = eventAggregator;
_logger = logger;
@ -94,12 +98,23 @@ public List<RemoteEpisode> GetPendingRemoteEpisodes(int seriesId)
{
var queued = new List<Queue.Queue>();
var nextRssSync = new Lazy<DateTime>(() => _taskManager.GetNextExecution(typeof(RssSyncCommand)));
foreach (var pendingRelease in GetPendingReleases())
{
foreach (var episode in pendingRelease.RemoteEpisode.Episodes)
{
var ect = pendingRelease.Release.PublishDate.AddMinutes(GetDelay(pendingRelease.RemoteEpisode));
if (ect < nextRssSync.Value)
{
ect = nextRssSync.Value;
}
else
{
ect = ect.AddMinutes(_configService.RssSyncInterval);
}
var queue = new Queue.Queue
{
Id = GetQueueId(pendingRelease, episode),

View File

@ -24,6 +24,7 @@ public interface ITaskManager
{
IList<ScheduledTask> GetPending();
List<ScheduledTask> GetAll();
DateTime GetNextExecution(Type type);
}
public class TaskManager : ITaskManager, IHandle<ApplicationStartedEvent>, IHandle<CommandExecutedEvent>, IHandleAsync<ConfigSavedEvent>
@ -51,6 +52,12 @@ public List<ScheduledTask> GetAll()
return _scheduledTaskRepository.All().ToList();
}
public DateTime GetNextExecution(Type type)
{
var scheduledTask = _scheduledTaskRepository.All().Single(v => v.TypeName == type.FullName);
return scheduledTask.LastExecution.AddMinutes(scheduledTask.Interval);
}
public void Handle(ApplicationStartedEvent message)
{
var defaultTasks = new[]

View File

@ -14,9 +14,7 @@ module.exports = NzbDroneCell.extend({
if (this.cellValue.get('status').toLowerCase() === 'pending') {
var ect = this.cellValue.get('estimatedCompletionTime');
var time = '{0} at {1}'.format(FormatHelpers.relativeDate(ect), moment(ect).format(UiSettingsModel.time(true, false)));
this.$el.html('-');
this.$el.attr('title', 'Will be processed during the first RSS Sync after {0}'.format(time));
this.$el.html('<div title="Delaying download till {0}">-</div>'.format(time));
return this;
}