@@ -109,7 +109,8 @@ declare function api:documents-findByAuthor($model as map(*)) as map(*) {
109
109
};
110
110
111
111
declare function api:documents-otd ($model as map (*)) as map (*) {
112
- let $date :=
112
+ let $dateWithoutYear :=
113
+ (: strip of the year part so only month and day are left, e.g. "12-03" :)
113
114
if ($model?date castable as xs:date)
114
115
then $model?date => substring (6 , 5 )
115
116
else current-date () => substring (6 , 5 )
@@ -120,9 +121,13 @@ declare function api:documents-otd($model as map(*)) as map(*) {
120
121
case 'letters' return
121
122
core:getOrCreateColl (
122
123
$docType,'indices' , true ()
123
- )//tei:TEI[ft:query (., 'date:' || $date)]//tei:correspAction[@type ='sent' ]/tei:date[contains (@when , $date)][following::tei:text //tei:p]
124
- (: case 'persons' return:)
125
- (: core:getOrCreateColl($docType, 'indices', true())//tei:date[contains(@when, $month-day)][not(preceding-sibling::tei:date[contains(@when, $month-day)])][parent::tei:birth or parent::tei:death][ancestor::tei:person/@source='WeGA']:)
124
+ )//tei:TEI[ft:query (., 'date:' || $dateWithoutYear)]//tei:correspAction[@type ='sent' ]/tei:date
125
+ [contains (@when , $dateWithoutYear)][following::tei:text //tei:p]
126
+ case 'persons' return
127
+ core:getOrCreateColl (
128
+ $docType, 'indices' , true ()
129
+ )//tei:person[ft:query (., 'date:' || $dateWithoutYear, map{'facets' : map{'docSource' : 'WeGA' }})]
130
+ //tei:date[contains (@when , $dateWithoutYear)][parent::tei:birth or parent::tei:death]
126
131
default return ()
127
132
return (
128
133
map {
@@ -571,13 +576,12 @@ declare %private function api:document-otd($dateElements as element(tei:date)*,
571
576
else if ($dateElem[@type ='funeral' ]) then 'wasBuried'
572
577
else if ($dateElem/parent::tei:death) then 'dies'
573
578
else ()
574
- let $isJubilee := ( year-from-date ($model?date) - $dateElem/year-from-date (@when )) mod 25 = 0
579
+ let $jubilee := year-from-date ($model?date) - $dateElem/year-from-date (@when )
575
580
return map:merge ((
576
581
api:document-basics ($dateElem/root (), $docID, $docType, $model),
577
582
map {
578
- 'otdTitle' : '' ,
579
583
'otdEvent' : $typeOfEvent,
580
- 'otdJubilee' : ''
584
+ 'otdJubilee' : $jubilee
581
585
}
582
586
))
583
587
}
0 commit comments