Enhance channel management: add support for preferred weight multipliers and preferred hours in channel shows, update related data models and API endpoints, and implement validation for new properties. Refactor scheduling logic to utilize preferred hours for weight adjustments during show planning.
This commit is contained in:
@@ -51,6 +51,7 @@ public sealed class ScheduleGenerator(
|
||||
{
|
||||
var channel = await dbContext.Channels
|
||||
.Include(c => c.Shows)
|
||||
.ThenInclude(s => s.PreferredHours)
|
||||
.Include(c => c.Ads)
|
||||
.Include(c => c.BumperTemplates)
|
||||
.ThenInclude(t => t.Variants)
|
||||
@@ -161,7 +162,14 @@ public sealed class ScheduleGenerator(
|
||||
)
|
||||
return null;
|
||||
|
||||
return ScheduleEntry.Bumper(channelId, assetId, entry.StartsAtUtc, entry.EndsAtUtc, entry.ToShowId);
|
||||
return ScheduleEntry.Bumper(
|
||||
channelId,
|
||||
assetId,
|
||||
entry.StartsAtUtc,
|
||||
entry.EndsAtUtc,
|
||||
entry.ToShowId,
|
||||
entry.BumperVariantId
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -525,7 +533,11 @@ public sealed class ScheduleGenerator(
|
||||
channelShow.BlockMode,
|
||||
channelShow.BlockValue,
|
||||
ready,
|
||||
channelShow.NextEpisodeIndex
|
||||
channelShow.NextEpisodeIndex,
|
||||
channelShow.PreferredHours
|
||||
.Select(h => new PlannerHourWindow(h.StartHour, h.EndHour))
|
||||
.ToList(),
|
||||
channelShow.PreferredWeightMultiplier
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -544,7 +556,7 @@ public sealed class ScheduleGenerator(
|
||||
var dur = TimeSpan.FromSeconds(AlignedDurationSeconds(TemplateDurationSeconds(t)));
|
||||
return t.Variants
|
||||
.OrderBy(v => v.Position)
|
||||
.Select(v => new PlannerBumperVariant(v.Id, t.Id, dur, v.Trigger));
|
||||
.Select(v => new PlannerBumperVariant(v.Id, t.Id, dur, v.Trigger, v.Weight));
|
||||
})
|
||||
.ToList();
|
||||
|
||||
@@ -561,7 +573,9 @@ public sealed class ScheduleGenerator(
|
||||
channel.BumpersEnabled,
|
||||
TimeSpan.FromMinutes(channel.BumperMinIntervalMinutes),
|
||||
channel.BumperSelection,
|
||||
bumperVariants
|
||||
bumperVariants,
|
||||
channel.BumperShowChangeChance,
|
||||
channel.BumperEpisodeChangeChance
|
||||
);
|
||||
|
||||
return new PlannerInput(
|
||||
|
||||
Reference in New Issue
Block a user