Director's Chair: place or drop from a pop-up
Pressing a pick opens its pop-up: place it on the suggested channel, change to another channel the scoring allows (three at most, each with its reason), or drop it. An ask offers its two channels or Drop. Placing adds the title to that channel's own list as an accepted choice, so it joins at the next top-up; nothing is booked and committed bookings never change. Every decision is recorded, and decided titles make way for the next. A placed film's playable copy is found when the pool is read. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -96,6 +96,39 @@ class DirectorChairTest {
|
||||
assertTrue(ev.exists())
|
||||
}
|
||||
|
||||
@Test fun picksCarryTheirChoicesAndDecidedTitlesMakeWayForTheNext() {
|
||||
val cands = listOf(line("101", "Ocean Life", "Series", listOf("Documentary"), "Wildlife of the ocean: reefs, sharks and the species of the deep sea."),
|
||||
line("102", "Forest Life", "Series", listOf("Documentary"), "Wildlife of the forest: animals and species of the ancient woods and nature."))
|
||||
val (ev, sets) = files(cands)
|
||||
val released = listOf(arrival("101", "Ocean Life"), arrival("102", "Forest Life"))
|
||||
val before = buildDeskReport(ev, sets, pools, released, emptySet(), emptyMap(), 2, true, DirectorMode.Balanced, 1_793_800_000_000)
|
||||
val pick = before.picks.first()
|
||||
assertEquals(1, before.picks.size); assertEquals("Series", pick.type) // one pick per channel: both are Terra's
|
||||
assertEquals(201, pick.options.first().number) // the suggested channel first
|
||||
assertTrue(pick.options.size <= 3); assertTrue(pick.options.none { it.number == 107 }) // never a channel the scoring ruled out (Evidence takes no documentaries)
|
||||
assertTrue(pick.options.first().reason.isNotBlank())
|
||||
// Once decided, a title isn't shown again; the counts stay as they were.
|
||||
val after = buildDeskReport(ev, sets, pools, released, emptySet(), emptyMap(), 2, true, DirectorMode.Balanced, 1_793_800_000_000, decided = setOf(pick.id))
|
||||
assertTrue(after.picks.none { it.id == pick.id }); assertEquals(before.strong, after.strong); assertEquals(1, after.decided)
|
||||
assertEquals(setOf("101", "102") - pick.id, after.picks.map { it.id }.toSet()) // the next one takes its place
|
||||
val back = DeskReport.of(before.toJson()).picks.first()
|
||||
assertEquals(pick.id, back.id); assertEquals(pick.options.map { it.number }, back.options.map { it.number }); assertEquals(pick.year, back.year)
|
||||
}
|
||||
|
||||
@Test fun placingAddsToTheChannelsOwnListAndDropOnlyRecords() {
|
||||
val dir = kotlin.io.path.createTempDirectory("chair").toFile().apply { deleteOnExit() }
|
||||
val store = ScheduleStore(dir); val user = "a1b2c3"
|
||||
placeFromChair(store, user, "5000001", "Ocean Life", "Series", 2026, 201, 201, 10)
|
||||
placeFromChair(store, user, "5000001", "Ocean Life", "Series", 2026, 201, 201, 11) // twice: still once on the list
|
||||
assertEquals(listOf("5000001"), store.loadChoices(user, 201).accepted.map { it.id })
|
||||
dropFromChair(store, "5000002", "Wedding Bells", "Movie", 609, 12)
|
||||
assertTrue(store.loadChoices(user, 609).accepted.isEmpty())
|
||||
val record = loadDecisions(store.decisionsFile())
|
||||
assertEquals(listOf("5000001" to true, "5000002" to false), record.map { it.id to it.placed })
|
||||
assertEquals(201, record.first().channel); assertNull(record.last().channel); assertEquals(609, record.last().suggested)
|
||||
assertThrows(IllegalArgumentException::class.java) { placeFromChair(store, user, "5000003", "A Season", "Season", null, 201, 201) }
|
||||
}
|
||||
|
||||
@Test fun aReportReadsBackAsItWasSaved() {
|
||||
val r = DeskReport(10, 2, 9, 1, listOf("Terra" to 1), 1, listOf(DeskPick("A", "Terra", "STRONG MATCH", "Line")), listOf(DeskAsk("B", "Sci-Fi", "Horror")), 0, false, 0, 5, 6)
|
||||
val back = DeskReport.of(r.toJson())
|
||||
|
||||
Reference in New Issue
Block a user