1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Typo in ical url handling when choosing premieres only.

This commit is contained in:
Taloth Saldono 2019-03-17 23:23:05 +01:00
parent ecebe73c33
commit 341dfb934d
2 changed files with 14 additions and 6 deletions

View File

@ -37,7 +37,7 @@ private Response GetCalendarFeed()
var start = DateTime.Today.AddDays(-pastDays); var start = DateTime.Today.AddDays(-pastDays);
var end = DateTime.Today.AddDays(futureDays); var end = DateTime.Today.AddDays(futureDays);
var unmonitored = false; var unmonitored = false;
var premiersOnly = false; var premieresOnly = false;
var asAllDay = false; var asAllDay = false;
var tags = new List<int>(); var tags = new List<int>();
@ -47,6 +47,7 @@ private Response GetCalendarFeed()
var queryPastDays = Request.Query.PastDays; var queryPastDays = Request.Query.PastDays;
var queryFutureDays = Request.Query.FutureDays; var queryFutureDays = Request.Query.FutureDays;
var queryUnmonitored = Request.Query.Unmonitored; var queryUnmonitored = Request.Query.Unmonitored;
var queryPremieresOnly = Request.Query.PremieresOnly;
var queryPremiersOnly = Request.Query.PremiersOnly; var queryPremiersOnly = Request.Query.PremiersOnly;
var queryAsAllDay = Request.Query.AsAllDay; var queryAsAllDay = Request.Query.AsAllDay;
var queryTags = Request.Query.Tags; var queryTags = Request.Query.Tags;
@ -71,10 +72,16 @@ private Response GetCalendarFeed()
unmonitored = bool.Parse(queryUnmonitored.Value); 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) if (queryAsAllDay.HasValue)
{ {
@ -99,7 +106,7 @@ private Response GetCalendarFeed()
foreach (var episode in episodes.OrderBy(v => v.AirDateUtc.Value)) 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; continue;
} }

View File

@ -37,7 +37,8 @@ private Response GetCalendarFeed()
var start = DateTime.Today.AddDays(-pastDays); var start = DateTime.Today.AddDays(-pastDays);
var end = DateTime.Today.AddDays(futureDays); var end = DateTime.Today.AddDays(futureDays);
var unmonitored = Request.GetBooleanQueryParameter("unmonitored"); 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 asAllDay = Request.GetBooleanQueryParameter("asAllDay");
var tags = new List<int>(); var tags = new List<int>();
@ -75,7 +76,7 @@ private Response GetCalendarFeed()
foreach (var episode in episodes.OrderBy(v => v.AirDateUtc.Value)) 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; continue;
} }