Refactor various components to improve code clarity and maintainability. Update ListUsersQueryHandler to utilize UserListFilter for parameter handling. Refactor BumperSpecFactory and related classes to encapsulate input parameters into dedicated records, enhancing readability. Adjust MediaAsset and Slot classes to streamline content updates with new content models. Improve BumperRenderBackgroundService and MediaProcessingBackgroundService to use MediaReadyInfo for asset readiness, ensuring consistent parameter management across the application.
This commit is contained in:
+7
-4
@@ -39,16 +39,19 @@ public sealed class ListInterstitialBlocksQueryHandler(IAppDbContext dbContext)
|
||||
.Select(a => new { a.Id, a.Duration })
|
||||
.ToDictionaryAsync(a => a.Id, a => a.Duration!.Value.TotalSeconds, cancellationToken);
|
||||
|
||||
// Длительность шоу-ролика считаем один раз: одно и то же шоу встречается в нескольких блоках.
|
||||
var clipSeconds = clips.ToDictionary(
|
||||
pair => pair.Key,
|
||||
pair => pair.Value.Sum((Guid assetId) => durations.GetValueOrDefault(assetId, 0d))
|
||||
);
|
||||
|
||||
return collections
|
||||
.Where(c => c.Items.Count > 0 && c.Items.All(i => clips.ContainsKey(i.ShowId)))
|
||||
.Select(c => new InterstitialBlockDto(
|
||||
c.Id,
|
||||
c.Name,
|
||||
c.Items.Count,
|
||||
c.Items.Sum(i =>
|
||||
clips[i.ShowId]
|
||||
.Sum(assetId => durations.TryGetValue(assetId, out var d) ? d : 0)
|
||||
)
|
||||
c.Items.Sum(i => clipSeconds[i.ShowId])
|
||||
))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user