diff --git a/.editorconfig b/.editorconfig index 723c28878..1444c1772 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ [*] charset=utf-8 end_of_line=lf -trim_trailing_whitespace=false +trim_trailing_whitespace=true insert_final_newline=false indent_style=space indent_size=4 diff --git a/ErsatzTV.Application/Channels/Commands/RefreshChannelDataHandler.cs b/ErsatzTV.Application/Channels/Commands/RefreshChannelDataHandler.cs index 6b84bcfea..20d3f9773 100644 --- a/ErsatzTV.Application/Channels/Commands/RefreshChannelDataHandler.cs +++ b/ErsatzTV.Application/Channels/Commands/RefreshChannelDataHandler.cs @@ -170,13 +170,13 @@ public class RefreshChannelDataHandler : IRequestHandler await using var xml = XmlWriter.Create( ms, new XmlWriterSettings { Async = true, ConformanceLevel = ConformanceLevel.Fragment }); - + int daysToBuild = await _configElementRepository .GetValue(ConfigElementKey.XmltvDaysToBuild) .IfNoneAsync(2); DateTimeOffset finish = DateTimeOffset.UtcNow.AddDays(daysToBuild); - + foreach (Playout playout in playouts) { switch (playout.ProgramSchedulePlayoutType) @@ -367,6 +367,11 @@ public class RefreshChannelDataHandler : IRequestHandler TimeSpan groupDuration = groupFinish - groupStart; var itemsToInclude = group.Filter(g => g.FillerKind is FillerKind.None).ToList(); + if (itemsToInclude.Count == 0) + { + continue; + } + TimeSpan perItem = groupDuration / itemsToInclude.Count; DateTimeOffset currentStart = new DateTimeOffset(groupStart, TimeSpan.Zero).ToLocalTime();