fix effective block tests (#2600)
* fix effective block tests running on github * update dependencies * pass tz again * use tzconvert for time zones in tests * temporary logging * maybe fix * test cleanup
This commit is contained in:
@@ -7,14 +7,13 @@ internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset St
|
||||
public static List<EffectiveBlock> GetEffectiveBlocks(
|
||||
ICollection<PlayoutTemplate> templates,
|
||||
DateTimeOffset start,
|
||||
TimeZoneInfo timeZone,
|
||||
int daysToBuild)
|
||||
{
|
||||
var timeZone = TimeZoneInfo.Local;
|
||||
|
||||
DateTimeOffset finish = start.AddDays(daysToBuild);
|
||||
|
||||
var effectiveBlocks = new List<EffectiveBlock>();
|
||||
DateTimeOffset current = start.Date;
|
||||
DateTimeOffset current = new DateTimeOffset(start.Year, start.Month, start.Day, 0, 0, 0, start.Offset);
|
||||
while (current < finish)
|
||||
{
|
||||
Option<PlayoutTemplate> maybeTemplate = PlayoutTemplateSelector.GetPlayoutTemplateFor(templates, current);
|
||||
@@ -23,12 +22,12 @@ internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset St
|
||||
// logger.LogDebug(
|
||||
// "Will schedule day {Date} using template {Template}",
|
||||
// current,
|
||||
// playoutTemplate.Template.Name);
|
||||
// playoutTemplate.Template.Id);
|
||||
|
||||
DateTimeOffset today = current;
|
||||
|
||||
var newBlocks = playoutTemplate.Template.Items
|
||||
.Map(i => ToEffectiveBlock(playoutTemplate, i, today))
|
||||
.Map(i => ToEffectiveBlock(playoutTemplate, i, today, timeZone))
|
||||
.Map(NormalizeGuideMode)
|
||||
.ToList();
|
||||
|
||||
@@ -48,7 +47,8 @@ internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset St
|
||||
private static EffectiveBlock ToEffectiveBlock(
|
||||
PlayoutTemplate playoutTemplate,
|
||||
TemplateItem templateItem,
|
||||
DateTimeOffset current)
|
||||
DateTimeOffset current,
|
||||
TimeZoneInfo timeZone)
|
||||
{
|
||||
var blockStartTime = new DateTime(
|
||||
current.Year,
|
||||
@@ -59,10 +59,13 @@ internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset St
|
||||
0,
|
||||
DateTimeKind.Unspecified);
|
||||
|
||||
// use the system's local time zone
|
||||
var timeZone = TimeZoneInfo.Local;
|
||||
var blockStart = new DateTimeOffset(blockStartTime, timeZone.GetUtcOffset(blockStartTime));
|
||||
|
||||
// logger.LogDebug(
|
||||
// "Starting block {Block} at {BlockStart}",
|
||||
// templateItem.Block.Name,
|
||||
// blockStart);
|
||||
|
||||
return new EffectiveBlock(
|
||||
templateItem.Block,
|
||||
new BlockKey(templateItem.Block, templateItem.Template, playoutTemplate),
|
||||
|
||||
Reference in New Issue
Block a user