From 341dfb934d993f0a1ff9028a9576019cb959da60 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 17 Mar 2019 23:23:05 +0100 Subject: [PATCH] Fixed: Typo in ical url handling when choosing premieres only. --- src/NzbDrone.Api/Calendar/CalendarFeedModule.cs | 15 +++++++++++---- src/Sonarr.Api.V3/Calendar/CalendarFeedModule.cs | 5 +++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs b/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs index aec7320e7..d636261e2 100644 --- a/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs +++ b/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs @@ -37,7 +37,7 @@ namespace NzbDrone.Api.Calendar var start = DateTime.Today.AddDays(-pastDays); var end = DateTime.Today.AddDays(futureDays); var unmonitored = false; - var premiersOnly = false; + var premieresOnly = false; var asAllDay = false; var tags = new List(); @@ -47,6 +47,7 @@ namespace NzbDrone.Api.Calendar var queryPastDays = Request.Query.PastDays; var queryFutureDays = Request.Query.FutureDays; var queryUnmonitored = Request.Query.Unmonitored; + var queryPremieresOnly = Request.Query.PremieresOnly; var queryPremiersOnly = Request.Query.PremiersOnly; var queryAsAllDay = Request.Query.AsAllDay; var queryTags = Request.Query.Tags; @@ -71,10 +72,16 @@ namespace NzbDrone.Api.Calendar unmonitored = bool.Parse(queryUnmonitored.Value); } - if (queryPremiersOnly.HasValue) + if (queryPremieresOnly.HasValue) { - premiersOnly = bool.Parse(queryPremiersOnly.Value); + premieresOnly = bool.Parse(queryPremieresOnly.Value); } + else if (queryPremiersOnly.HasValue) + { + // There was a typo, recognize mistyped 'premiersOnly' boolean too for background compat. + premieresOnly = bool.Parse(queryPremiersOnly.Value); + } + if (queryAsAllDay.HasValue) { @@ -99,7 +106,7 @@ namespace NzbDrone.Api.Calendar foreach (var episode in episodes.OrderBy(v => v.AirDateUtc.Value)) { - if (premiersOnly && (episode.SeasonNumber == 0 || episode.EpisodeNumber != 1)) + if (premieresOnly && (episode.SeasonNumber == 0 || episode.EpisodeNumber != 1)) { continue; } diff --git a/src/Sonarr.Api.V3/Calendar/CalendarFeedModule.cs b/src/Sonarr.Api.V3/Calendar/CalendarFeedModule.cs index d6a7fdf3e..222782603 100644 --- a/src/Sonarr.Api.V3/Calendar/CalendarFeedModule.cs +++ b/src/Sonarr.Api.V3/Calendar/CalendarFeedModule.cs @@ -37,7 +37,8 @@ namespace Sonarr.Api.V3.Calendar var start = DateTime.Today.AddDays(-pastDays); var end = DateTime.Today.AddDays(futureDays); var unmonitored = Request.GetBooleanQueryParameter("unmonitored"); - var premiersOnly = Request.GetBooleanQueryParameter("premiersOnly"); + // There was a typo, recognize both the correct 'premieresOnly' and mistyped 'premiersOnly' boolean for background compat. + var premieresOnly = Request.GetBooleanQueryParameter("premieresOnly") || Request.GetBooleanQueryParameter("premiersOnly"); var asAllDay = Request.GetBooleanQueryParameter("asAllDay"); var tags = new List(); @@ -75,7 +76,7 @@ namespace Sonarr.Api.V3.Calendar foreach (var episode in episodes.OrderBy(v => v.AirDateUtc.Value)) { - if (premiersOnly && (episode.SeasonNumber == 0 || episode.EpisodeNumber != 1)) + if (premieresOnly && (episode.SeasonNumber == 0 || episode.EpisodeNumber != 1)) { continue; }