diff options
Diffstat (limited to 'internal/calendar/calendar.go')
| -rw-r--r-- | internal/calendar/calendar.go | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/internal/calendar/calendar.go b/internal/calendar/calendar.go index f364321..19c0efb 100644 --- a/internal/calendar/calendar.go +++ b/internal/calendar/calendar.go @@ -258,16 +258,39 @@ func transferIfImpededEF(cel Celebration, when time.Time, occupiedByClass1, occu if cel.Rank != RankClass1 { return when } + // Is cel actually impeded on `when` at all? Compare its OWN precedence + // (via precedenceEF, the same function pickEF uses to decide the day) + // against the temporal office's, rather than testing the temporal + // office's class in isolation -- a plain "is the temporal day I class" + // test wrongly impedes a candidate that would in fact WIN a tie against + // it: RG 91 entry 4 (the Immaculate Conception, the Assumption) sits + // ABOVE entry 6 (Sundays), so the Immaculate Conception is not impeded + // by the Advent Sunday it may fall on at all, unlike an ordinary I-class + // feast (entry 11, e.g. St Joseph), which is. occupiedByClass1 still + // covers the separate case of a competing FIXED I-class SANCTORAL + // feast, which this temporal-only comparison cannot see. startTemporal := temporalEF(when) - startImpeded := startTemporal.Cel.Rank == RankClass1 || occupiedByClass1(when) + tCand := candidate{Cel: startTemporal.Cel, Temporal: true, Season: startTemporal.Season, Sunday: startTemporal.Sunday} + sCand := candidate{Cel: cel, Temporal: false} + startImpeded := precedenceEF(tCand) < precedenceEF(sCand) || occupiedByClass1(when) if !startImpeded { return when } day := when.AddDate(0, 0, 1) for i := 0; i < 30; i++ { b := temporalEF(day) - band := precedenceEF(candidate{Cel: b.Cel, Temporal: true, Season: b.Season, Sunday: b.Sunday}) - if band <= 3 || occupiedByClass1Or2(day) { + // A direct CLASS test, not precedenceEF's tie-break band: band + // encodes which of two EQUAL-class candidates wins a tie (e.g. a + // Sunday beats an equal-class feast, but a privileged Ember/late- + // Advent FERIA of the same class yields to one, defect 2) -- an + // unrelated question from RG 96's own "is this day itself I or II + // class" test. Reusing band here undercounted: a day within the + // Octave of the Nativity (26-31 Dec) is genuinely II class (RG 67), + // but as an ordinary, non-Sunday II-class temporal candidate its OWN + // band yields (5, not <=3) -- so band<=3 alone let an impeded I-class + // feast wrongly land there. isHighClass tests the class directly. + isHighClass := b.Cel.Rank == RankClass1 || b.Cel.Rank == RankClass2 + if isHighClass || occupiedByClass1Or2(day) { day = day.AddDate(0, 0, 1) // still I- or II-class; keep walking continue } |
