Orbit TV Times: every TV starts at Issue 1 (0.110.5)
Issues count from each TV's own first edition (kept in times-first; for a TV with editions already, the oldest one), so a household starting later begins at Issue 1. The page says 'Week of' the edition's first day, so a first edition made mid-week reads right. Existing editions keep their numbers (these TVs stay on Issue 1 this week). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,11 @@ class UpNextAndTimesTest {
|
||||
assertEquals(java.time.LocalDate.of(2026, 11, 8), timesSunday(java.time.LocalDate.of(2026, 11, 8)))
|
||||
assertEquals(java.time.LocalDate.of(2026, 11, 8), timesSunday(java.time.LocalDate.of(2026, 11, 14)))
|
||||
assertEquals(java.time.LocalDate.of(2026, 11, 15), timesSunday(java.time.LocalDate.of(2026, 11, 15)))
|
||||
assertEquals(1L, timesIssue(java.time.LocalDate.of(2026, 11, 8))); assertEquals(2L, timesIssue(java.time.LocalDate.of(2026, 11, 15)))
|
||||
val first8 = java.time.LocalDate.of(2026, 11, 8)
|
||||
assertEquals(1L, timesIssue(first8, first8)); assertEquals(2L, timesIssue(java.time.LocalDate.of(2026, 11, 15), first8))
|
||||
// A household that starts later starts at Issue 1 too.
|
||||
val late = java.time.LocalDate.of(2026, 11, 29)
|
||||
assertEquals(1L, timesIssue(late, late)); assertEquals(2L, timesIssue(java.time.LocalDate.of(2026, 12, 6), late))
|
||||
val zone = ZoneId.of("Europe/London"); val dir = java.nio.file.Files.createTempDirectory("times").toFile()
|
||||
val day = ZonedDateTime.of(2026, 11, 9, 13, 0, 0, 0, zone).toInstant().toEpochMilli()
|
||||
val eight = ZonedDateTime.of(2026, 11, 9, 20, 0, 0, 0, zone).toInstant().toEpochMilli()
|
||||
@@ -54,6 +58,11 @@ class UpNextAndTimesTest {
|
||||
assertEquals(first.toString(), later.toString())
|
||||
// The next Sunday is a new issue.
|
||||
val next = OrbitCompanion.timesEdition(screenWith("Shaun of the Dead"), dir, ZonedDateTime.of(2026, 11, 15, 13, 0, 0, 0, zone).toInstant().toEpochMilli(), zone)
|
||||
assertEquals(2, next.optInt("issue", 2))
|
||||
assertEquals(2, next.getInt("issue"))
|
||||
// The first edition's Sunday is remembered for this TV.
|
||||
assertEquals("2026-11-08", java.io.File(dir, "times-first").readText())
|
||||
// A TV that started later counts from its own first week.
|
||||
val other = java.nio.file.Files.createTempDirectory("times2").toFile()
|
||||
assertEquals(1, OrbitCompanion.timesEdition(screenWith("Hot Fuzz"), other, ZonedDateTime.of(2026, 11, 25, 13, 0, 0, 0, zone).toInstant().toEpochMilli(), zone).getInt("issue"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user