From 2da23ae230eb30fe69c43b01211164c96bc9c316 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 22 Feb 2015 22:09:06 +0100 Subject: [PATCH] Fixed tooltip for pending queue items. --- .../Download/Pending/PendingReleaseService.cs | 15 +++++++++++++++ src/NzbDrone.Core/Jobs/TaskManager.cs | 7 +++++++ src/UI/Activity/Queue/TimeleftCell.js | 4 +--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs index 0945883f8..d437898e9 100644 --- a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs +++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs @@ -7,6 +7,7 @@ using NzbDrone.Common.Extensions; 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 @@ namespace NzbDrone.Core.Download.Pending 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 @@ namespace NzbDrone.Core.Download.Pending ISeriesService seriesService, IParsingService parsingService, IDelayProfileService delayProfileService, + ITaskManager taskManager, IConfigService configService, IEventAggregator eventAggregator, Logger logger) @@ -54,6 +57,7 @@ namespace NzbDrone.Core.Download.Pending _seriesService = seriesService; _parsingService = parsingService; _delayProfileService = delayProfileService; + _taskManager = taskManager; _configService = configService; _eventAggregator = eventAggregator; _logger = logger; @@ -94,12 +98,23 @@ namespace NzbDrone.Core.Download.Pending { var queued = new List(); + var nextRssSync = new Lazy(() => _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), diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index fc1ab1739..981cf59f7 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -24,6 +24,7 @@ namespace NzbDrone.Core.Jobs { IList GetPending(); List GetAll(); + DateTime GetNextExecution(Type type); } public class TaskManager : ITaskManager, IHandle, IHandle, IHandleAsync @@ -51,6 +52,12 @@ namespace NzbDrone.Core.Jobs 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[] diff --git a/src/UI/Activity/Queue/TimeleftCell.js b/src/UI/Activity/Queue/TimeleftCell.js index cdb054c96..561fc8068 100644 --- a/src/UI/Activity/Queue/TimeleftCell.js +++ b/src/UI/Activity/Queue/TimeleftCell.js @@ -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('
-
'.format(time)); return this; }