From 4c923bd6b5ebb7a720a05eb0c74c7a805bb9b559 Mon Sep 17 00:00:00 2001 From: Pauljd Date: Wed, 4 Nov 2026 17:47:22 +0000 Subject: [PATCH] Network audit: report, not fail, a premiere-night film repeat when nothing else fits (Paul chose on time, option 2) Co-Authored-By: Claude Opus 5.5 (1M context) --- .../test/java/tv/orbit/classic/FinalNetworkAuditTest.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/app/src/test/java/tv/orbit/classic/FinalNetworkAuditTest.kt b/android/app/src/test/java/tv/orbit/classic/FinalNetworkAuditTest.kt index c8409a7d..e6b99586 100644 --- a/android/app/src/test/java/tv/orbit/classic/FinalNetworkAuditTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/FinalNetworkAuditTest.kt @@ -105,6 +105,11 @@ class FinalNetworkAuditTest { val waits = if (isFilmChannel) emptyMap() else inBlocks.filter { !it.isFilm }.associate { s -> s.title to (listOf(first) + entries.filter { it.seriesId == s.id }.map { it.startMs } + listOf(last)).zipWithNext().maxOf { (a, b) -> b - a } / day.toDouble() } val fileGaps = entries.groupBy { it.media.item.id }.values.flatMap { es -> es.zipWithNext().map { (a, b) -> b.startMs - a.startMs to b } } val sameDay = fileGaps.count { (g, b) -> g < day && (weightedAt(b) || isFilmChannel) } + // Paul chose on time over no repeats for the film before a premiere (4 November 2026): when no other short film + // fits before 21:00, the one shown the night before may play again. Reported, not a failure. + val premiereFilmRepeats = fileGaps.count { (g, b) -> g < day && b.media.item.type == "Movie" && p.dayParts.any { it.premiereNights == true && it.key == b.presentation } && + p.dayParts.any { it.premiere } && entries.any { e -> e.presentation == p.dayParts.first { it.premiere }.key && e.startMs in b.endMs..(b.endMs + 30 * 60_000L) } } + if (premiereFilmRepeats > 0) notes.appendLine("- ${p.name}: $premiereFilmRepeats film(s) before a premiere repeated the night before's, as approved, because nothing else fitted") val sameWeek = fileGaps.count { it.first < 7 * day } val twice = if (isFilmChannel) 0 else entries.zipWithNext().count { (a, b) -> a.seriesId == b.seriesId && weightedAt(b) && choice(b) && "elsewhere then" !in b.why } val ordered = series.filter { !(p.shuffleEpisodes || p.mixes(it)) && !it.isFilm }.associateBy { it.id } @@ -133,7 +138,7 @@ class FinalNetworkAuditTest { } // Hard rules. val kept = all.getValue(p.number).sortedBy { it.startMs }.take(committed.getValue(p.number).entries.size) == committed.getValue(p.number).entries - val failures = listOf("committed kept" to (if (kept) 0 else 1), "gaps" to gaps, "in-order stepping back" to back, "off deck" to offDeck, "same file within 24 h (weighted)" to sameDay.takeIf { p.tierWeights != null }.let { it ?: 0 }, + val failures = listOf("committed kept" to (if (kept) 0 else 1), "gaps" to gaps, "in-order stepping back" to back, "off deck" to offDeck, "same file within 24 h (weighted)" to (sameDay - premiereFilmRepeats).takeIf { p.tierWeights != null }.let { it ?: 0 }, "twice running with a choice (weighted)" to twice, "clashes" to (clashCount[p.number] ?: 0)).filter { it.second > 0 } failures.forEach { (what, n) -> notes.appendLine("- **${p.name}: $what $n**"); hardFailures++ } }