Fixed: Tag filtering on iCal feed

This commit is contained in:
Mark McDowall 2023-04-19 16:00:05 -07:00
parent 7ed0407e77
commit a989c84260
1 changed files with 5 additions and 5 deletions

View File

@ -28,15 +28,15 @@ namespace Sonarr.Api.V3.Calendar
} }
[HttpGet("Sonarr.ics")] [HttpGet("Sonarr.ics")]
public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tagList = "", bool unmonitored = false, bool premieresOnly = false, bool asAllDay = false) public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tags = "", bool unmonitored = false, bool premieresOnly = false, bool asAllDay = false)
{ {
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 tags = new List<int>(); var parsedTags = new List<int>();
if (tagList.IsNotNullOrWhiteSpace()) if (tags.IsNotNullOrWhiteSpace())
{ {
tags.AddRange(tagList.Split(',').Select(_tagService.GetTag).Select(t => t.Id)); parsedTags.AddRange(tags.Split(',').Select(_tagService.GetTag).Select(t => t.Id));
} }
var episodes = _episodeService.EpisodesBetweenDates(start, end, unmonitored); var episodes = _episodeService.EpisodesBetweenDates(start, end, unmonitored);
@ -59,7 +59,7 @@ namespace Sonarr.Api.V3.Calendar
continue; continue;
} }
if (tags.Any() && tags.None(series.Tags.Contains)) if (parsedTags.Any() && parsedTags.None(series.Tags.Contains))
{ {
continue; continue;
} }