Shorts: a slot under 15 minutes aims for the next half hour; variety within turn order
A slot that can't fit its next short before reaching 15 minutes now aims for the half hour after, instead of closing as a fragment beside another slot. Inside a slot, a show not yet in it goes ahead of one that is when it's next but one in turn, so variety improves without bending the week's fairness. Replay compares the settings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -89,12 +89,19 @@ class ShortsReplayTest {
|
||||
val loose = after.count { isShort(it.media.durationMs) && it.group.isEmpty() }
|
||||
val lengths = blocks.map { it.endMs - it.startMs }.sorted()
|
||||
val repeats = blocks.sumOf { b -> b.entries.zipWithNext().count { (a, c) -> a.seriesId == c.seriesId } }
|
||||
assertEquals("${programming.name}: no show twice in a row in a slot", 0, repeats)
|
||||
val returns = blocks.sumOf { b -> b.entries.size - b.entries.map { it.seriesId }.distinct().size }
|
||||
val couldVary = blocks.count { b -> b.entries.size > b.entries.map { it.seriesId }.distinct().size }
|
||||
val shortSlots = blocks.filter { it.endMs - it.startMs < SHORTS_SLOT_MIN_MS }
|
||||
out.append("\n${programming.name} ($number)\n")
|
||||
out.append(" Programmes booked: ${before.size} before, ${after.size} after; shorts among them: $shortsBefore before, $shortsAfter after\n")
|
||||
out.append(" Shorts slots: ${blocks.size}, holding ${blocks.sumOf { it.entries.size }} shorts; $loose short(s) left on their own (a slot of one, or the block changed)\n")
|
||||
if (lengths.isNotEmpty()) out.append(" Slot length: shortest ${mins(lengths.first())} min, median ${mins(lengths[lengths.size / 2])}, longest ${mins(lengths.last())}; " +
|
||||
"${blocks.count { onHalfHour(it.endMs) }} of ${blocks.size} end within 2 min of :00 or :30\n")
|
||||
out.append(" Shows per slot: average ${"%.1f".format(blocks.map { it.shows.size }.average())}; the same show twice in a row inside a slot: $repeats time(s)\n")
|
||||
out.append(" Shows per slot: average ${"%.1f".format(blocks.map { it.shows.size }.average())}; the same show twice in a row inside a slot: $repeats time(s); a show back later in the same slot: $returns time(s), in $couldVary slot(s)\n")
|
||||
out.append(" Slots under 15 minutes: ${shortSlots.size}${if (shortSlots.isEmpty()) "" else ": " + shortSlots.take(6).joinToString { blk ->
|
||||
val next = after.firstOrNull { it.startMs == blk.endMs }
|
||||
"${clock(blk.startMs)} ${mins(blk.endMs - blk.startMs)} min, then ${next?.let(::name) ?: "?"} (${next?.let { mins(it.media.durationMs) } ?: "?"} min)" }}\n")
|
||||
out.append(" Programmes starting within 2 min of :00 or :30: ${before.count { onHalfHour(it.startMs) }} of ${before.size} before, ${after.count { onHalfHour(it.startMs) }} of ${after.size} after\n")
|
||||
out.append(" Labels: ${blocks.groupingBy { it.label }.eachCount()}\n")
|
||||
val airtime = { run: List<ScheduleEntry> -> run.groupBy(::name).mapValues { (_, v) -> v.sumOf { it.media.durationMs } / 60_000 } }
|
||||
|
||||
Reference in New Issue
Block a user