diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 15:07:12 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 15:07:12 +0200 |
| commit | 310ac404f25b412c5c1ead12247b4eb36e9f0025 (patch) | |
| tree | 6e1dcc5e1f85a483cef7044d341b7c940c1690a8 /internal/calendar/precedence.go | |
| parent | 44472bbe31475a3c672ae003d928d7caffb4b50a (diff) | |
| parent | c5abf87fa7198c8f245f407774e2326e4b6c9b9c (diff) | |
| download | lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.tar.gz lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.zip | |
Merge branch 'engine-precedence-fixes': OF/EF calendar+readings flawlessness pass
Per-day validation vs litcal (OF) and missalemeum (EF) 2005-2050, all defects
fixed and re-validated to zero: OF calendar 0 real errors forward, OF readings
0 unresolvable, EF 0 reading gaps + resumed Sundays correct.
Diffstat (limited to 'internal/calendar/precedence.go')
| -rw-r--r-- | internal/calendar/precedence.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/calendar/precedence.go b/internal/calendar/precedence.go index 3b7c0a6..3c7bf5f 100644 --- a/internal/calendar/precedence.go +++ b/internal/calendar/precedence.go @@ -82,6 +82,13 @@ func pick(cands []candidate) (candidate, []candidate) { if pi != pj { return pi < pj } + // Within a band, higher liturgical dignity wins (Table of Liturgical Days: + // of the Lord, then of the BVM, then of saints) -- so a Lord's solemnity + // (Sacred Heart, Corpus Christi) outranks a coinciding saint's solemnity + // rather than losing an alphabetical tie. + if di, dj := dignity(sorted[i].Cel), dignity(sorted[j].Cel); di != dj { + return di < dj + } return sorted[i].Cel.Slug < sorted[j].Cel.Slug }) // General Norms 60: when two obligatory memorials fall on the same day, both @@ -108,6 +115,20 @@ func pick(cands []candidate) (candidate, []candidate) { return sorted[0], sorted[1:] } +// dignity ranks a celebration within its precedence band by the Table of +// Liturgical Days' order of dignity: of the Lord (0), of the BVM (1), of saints +// or unclassified (2). +func dignity(c Celebration) int { + switch c.Class { + case ClassLord: + return 0 + case ClassBVM: + return 1 + default: + return 2 + } +} + // slugIndex returns the position of the candidate with the given slug, or -1. func slugIndex(cands []candidate, slug string) int { for i, c := range cands { |
