Heroes Live simulation: switch-on at exact hours too
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,8 +97,8 @@ class HeroesLiveSimulationTest {
|
||||
}
|
||||
// Switching the channel on (Paul, 30 November 2026): the first plan made at any time of day, and what its first two
|
||||
// evenings get at 21:00. A feature missing, or two features in one evening, would show here.
|
||||
for (hour in listOf(6, 12, 18, 20, 21, 22, 23, 2)) {
|
||||
val on = LocalDateTime.of(2026, 12, 1, hour, 17).atZone(zone).toInstant().toEpochMilli()
|
||||
for ((hour, minute) in listOf(6 to 0, 6 to 17, 12 to 0, 12 to 17, 18 to 17, 20 to 17, 21 to 0, 21 to 17, 22 to 17, 23 to 17, 2 to 17)) {
|
||||
val on = LocalDateTime.of(2026, 12, 1, hour, minute).atZone(zone).toInstant().toEpochMilli()
|
||||
val first = topUpPlan(null, ScheduleCursor(), pool, on, null, true, parts, zone, avoid = avoid, shuffle = false,
|
||||
fileRestMs = NETWORK_FILM_REST_MS, stories = true, network = NoNetworkRest)!!
|
||||
fun local(ms: Long) = Instant.ofEpochMilli(ms).atZone(zone)
|
||||
@@ -106,7 +106,8 @@ class HeroesLiveSimulationTest {
|
||||
val byEvening = (0..1).map { d -> val day = local(on).toLocalDate().plusDays(d.toLong())
|
||||
features.count { local(it.startMs).toLocalDate() == day && local(it.startMs).hour in 21..22 } }
|
||||
val early = features.filter { local(it.startMs).hour !in 21..22 }.map { "${local(it.startMs).toLocalTime()} ${it.media.item.title}" }
|
||||
report.append("switched on ${"%02d".format(hour)}:17: features at 21:00 tonight ${byEvening[0]}, tomorrow ${byEvening[1]}; features outside 21:00-23:00 $early\n")
|
||||
if (early.isNotEmpty()) File(out, "switch-on-$hour-$minute.tsv").writeText(first.entries.joinToString("\n") { "${local(it.startMs).toLocalDateTime()}\t${it.media.item.title}\t${presentationOf(it, parts, zone)}" })
|
||||
report.append("switched on ${"%02d:%02d".format(hour, minute)}: features at 21:00 tonight ${byEvening[0]}, tomorrow ${byEvening[1]}; features outside 21:00-23:00 $early\n")
|
||||
checks += listOf(byEvening.all { it <= 1 }, byEvening[1] == 1, early.isEmpty(), hour >= 21 || byEvening[0] == 1)
|
||||
}
|
||||
File(out, "summary.txt").writeText(report.toString()); println(report)
|
||||
|
||||
Reference in New Issue
Block a user