Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
M mom-ca
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 407
    • Issues 407
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • mom-ca
  • Issues
  • #752

Closed
Open
Created Apr 11, 2018 by Administrator@rootMaintainer

handle decision on `cei:date` and `cei:dateRange` for chronological ordering in a common function

Created by: GVogeler

As https://github.com/icaruseu/mom-ca/blob/master/my/XRX/src/mom/app/charters/charters.xqm#L80-L83 handle the same problem as the solution of https://github.com/icaruseu/mom-ca/pull/751 if would suggest to move the solution from https://github.com/icaruseu/mom-ca/issues/679#issuecomment-342526594 into a common function in charters.xqm:

declare function charters:date-selector($cei_issued, $range_limit as xs:string?) as xs:string {
 (: 
The function decides which dating element is the most expressive in a cei:issued structure:
$cei_issued is the cei:issued element which contains either cei:date/@value or cei:dateRange/(@from|@to) or both. 
$range_limit indicates if the function should return the lower or the upper value of cei:dateRange
Strategy is: 
1. the lower value is preferred (to get the dates below the generic "unknown" value '99999999')
2. if that does not help cei:date is preferred against cei:dateRange
:)
    let $rl := if(count($range_limit) = 0) then ('from') else ($range_limit)
    let $date := $cei_issued/(
      cei:date[
        not(../cei:dateRange) 
        or xs:integer(@value) lt xs:integer(../cei:dateRange/@*[name()=$range_limit])
        or xs:integer(@value) = xs:integer(../cei:dateRange/@*[name()=$range_limit])
        ]/@value
      |
      cei:dateRange[
        not(../cei:date) 
        or xs:integer(@*[name()=$range_limit]) lt xs:integer(../cei:date/@*[name()=$range_limit])
        ]/@*[name()=$range_limit]
    )
    return $date[1]/string()
};
Assignee
Assign to
"Fonds" Browser
Milestone
"Fonds" Browser
Assign milestone
Time tracking