fix(#515, #325): review round 4 - declined rows dropped by row, not by UID

This commit is contained in:
makiolaj committed 2026-11-14 03:31:47 +01:00
1 parent 1e83000696
commit 8e99c46f3e
2 files changed
+11 -3

No files matched your search

@@ -36,9 +36,10 @@ fun planCalendarCopy(
},
)
// A declined series still hands its accepted occurrences on before it goes.
val declined = declinedSeries.map { it.event.uid }.toSet()
return flattenOverrides(live, exdateStamp)
.filterNot { it.overrideOf == null && it.uid in declined }
// The flattened series follow the standalone occurrences, one per row in order.
val flat = flattenOverrides(live, exdateStamp)
val standalone = flat.size - live.series.size
return flat.filterIndexed { i, _ -> i < standalone || live.series[i - standalone].eventId !in declinedIds }
.map { it.toParsedIcsEvent() }
}
@@ -277,4 +277,11 @@ class CalendarRowsTest {
assertThat(IcsParser().parse(text).events.single().recurrenceDates)
.containsExactly("20260110T140000Z", "20260111T090000Z")
}
@Test
fun `a declined row takes no other row with its UID along`() {
val rows = CalendarRows(listOf(series("u").copy(declined = true), series("u", id = 2)), emptyList())
assertThat(planCalendarCopy(rows, ::formatExdateStamp)).hasSize(1)
}
}