summaryrefslogtreecommitdiff
path: root/internal/calendar/precedence.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/calendar/precedence.go')
-rw-r--r--internal/calendar/precedence.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/calendar/precedence.go b/internal/calendar/precedence.go
index 88cc0d8..3b7c0a6 100644
--- a/internal/calendar/precedence.go
+++ b/internal/calendar/precedence.go
@@ -84,5 +84,36 @@ func pick(cands []candidate) (candidate, []candidate) {
}
return sorted[i].Cel.Slug < sorted[j].Cel.Slug
})
+ // General Norms 60: when two obligatory memorials fall on the same day, both
+ // become optional and the weekday (ferial) is celebrated instead -- UNLESS one
+ // is Mary, Mother of the Church, whose 2018 institution decree gives it
+ // precedence over a coinciding obligatory memorial (then it is observed).
+ if len(sorted) >= 2 && !sorted[0].Temporal && !sorted[1].Temporal &&
+ sorted[0].Cel.Rank == RankMemorial && sorted[1].Cel.Rank == RankMemorial {
+ if i := slugIndex(sorted, "mary-mother-of-the-church"); i >= 0 {
+ motc := sorted[i]
+ sorted = append(sorted[:i], sorted[i+1:]...)
+ sorted = append([]candidate{motc}, sorted...)
+ } else {
+ for i, c := range sorted {
+ if c.Temporal {
+ ferial := sorted[i]
+ sorted = append(sorted[:i], sorted[i+1:]...)
+ sorted = append([]candidate{ferial}, sorted...)
+ break
+ }
+ }
+ }
+ }
return sorted[0], sorted[1:]
}
+
+// 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 {
+ if c.Cel.Slug == slug {
+ return i
+ }
+ }
+ return -1
+}