Enhance code readability and maintainability by refactoring various components. Update formatting commands in CLAUDE.md for csharpier integration. Simplify method signatures in SegmentFiles, UploadLimits, and multiple endpoint classes for improved clarity. Adjust query handlers and command handlers to streamline parameter handling and enhance consistency across the application.
ci / build-backend (push) Successful in 2m8s
ci / build-frontend (push) Failing after 32s
ci / tests (push) Skipped
ci / sonar (push) Skipped

This commit is contained in:
Leonid Pershin
2026-07-27 01:20:55 +03:00
parent 5449c05b5b
commit 9d1c6d2fc3
81 changed files with 716 additions and 461 deletions
@@ -125,7 +125,11 @@ public class CandidateFilterTests
var teen = Element(ShowAudience.Pg13, position: 1);
var pick = ElementSelector.Select(
Slot([adult, teen], maxAudience: ShowAudience.Pg13, strategy: SlotStrategyKind.Sequential),
Slot(
[adult, teen],
maxAudience: ShowAudience.Pg13,
strategy: SlotStrategyKind.Sequential
),
T0,
new FirstAlways()
);
@@ -193,9 +197,16 @@ public class CandidateFilterTests
lastPlayed: T0.AddDays(-10),
recentPlays: [T0.AddDays(-10), T0.AddDays(-9), T0.AddDays(-8)]
);
var recent = Element(position: 1, lastPlayed: T0.AddHours(-1), recentPlays: [T0.AddHours(-1)]);
var recent = Element(
position: 1,
lastPlayed: T0.AddHours(-1),
recentPlays: [T0.AddHours(-1)]
);
var slot = Slot([overCap, recent], repeatLimit: new RepeatLimit(WindowDays: 30, Max: 2)) with
var slot = Slot(
[overCap, recent],
repeatLimit: new RepeatLimit(WindowDays: 30, Max: 2)
) with
{
Strategy = new PlanningStrategy(SlotStrategyKind.RandomWithCooldown, CooldownDays: 2),
};
@@ -1,10 +1,10 @@
using System.Globalization;
using System.Text;
using TeleWave.Domain.Broadcast.Scheduling;
using GridPlanner = TeleWave.Domain.Programming.Planning.SchedulePlanner;
using TeleWave.Domain.Programming;
using TeleWave.Domain.Programming.Planning;
using Xunit;
using GridPlanner = TeleWave.Domain.Programming.Planning.SchedulePlanner;
namespace TeleWave.Domain.Tests.Programming;
@@ -43,9 +43,10 @@ public class GoldenScheduleTests
.Items.OrderBy(i => i.StartsAtUtc)
.Select(item =>
{
var label = item.ShowId is { } showId && names.TryGetValue(showId, out var name)
? $"{name}#{item.UnitIndex}"
: item.Kind.ToString();
var label =
item.ShowId is { } showId && names.TryGetValue(showId, out var name)
? $"{name}#{item.UnitIndex}"
: item.Kind.ToString();
return string.Create(
CultureInfo.InvariantCulture,
$"{item.StartsAtUtc:HH:mm} {label}"
@@ -60,10 +61,7 @@ public class GoldenScheduleTests
.Range(0, episodes)
.Select(i => new PlanningUnit(Guid.NewGuid(), TimeSpan.FromMinutes(minutes), showId, i))
.ToList();
return (
new PlanningElement(GroupElementKind.Show, Guid.NewGuid(), 1, 0, units),
showId
);
return (new PlanningElement(GroupElementKind.Show, Guid.NewGuid(), 1, 0, units), showId);
}
private static PlanningSlot ContentSlot(
@@ -129,12 +127,7 @@ public class GoldenScheduleTests
.ToList();
Assert.Equal(
[
"07:00 Мультфильмы#0",
"07:20 Мультфильмы#1",
"07:40 Мультфильмы#2",
"20:00 Кино#0",
],
["07:00 Мультфильмы#0", "07:20 Мультфильмы#1", "07:40 Мультфильмы#2", "20:00 Кино#0"],
tape
);
}
@@ -148,9 +141,7 @@ public class GoldenScheduleTests
// и разбег накапливается, пока его не подберёт следующий целевой старт.
var slots = Enumerable
.Range(0, 3)
.Select(i =>
ContentSlot(Day.AddHours(i), 60, [series], SlotBlockMode.Count, 2)
)
.Select(i => ContentSlot(Day.AddHours(i), 60, [series], SlotBlockMode.Count, 2))
.ToArray();
var input = new PlanningInput(
@@ -22,10 +22,7 @@ public class JunctionFillerTests
{
showId = Guid.NewGuid();
var id = showId;
var units = Enumerable
.Range(0, episodes)
.Select(i => Unit(minutes, id, i))
.ToList();
var units = Enumerable.Range(0, episodes).Select(i => Unit(minutes, id, i)).ToList();
return new PlanningElement(GroupElementKind.Show, Guid.NewGuid(), 1, 0, units);
}
@@ -116,7 +116,10 @@ public class SchedulePlannerTests
{
var element = Element(10, 20);
var result = Run(
Input([Slot(T0, 300, [element], SlotBlockMode.Duration, blockValue: 50)], horizonHours: 2)
Input(
[Slot(T0, 300, [element], SlotBlockMode.Duration, blockValue: 50)],
horizonHours: 2
)
);
// 20+20 < 50, третья добирает до 60 — обрезать видеофайл нельзя.