@@ -47,8 +47,12 @@ def aspace_collection(identifiers)
4747 relevant_ids = identifiers . map { |id | id [ 'value' ] if id [ 'kind' ] == 'Collection Identifier' } . compact
4848
4949 # In the highly unlikely event that there is more than one collection identifier, there's something weird going
50- # on with the record and we should skip it.
51- return if relevant_ids . count > 1
50+ # on with the record and we should look into it.
51+ if relevant_ids . count > 1
52+ Sentry . set_tags ( 'mitlib.recordId' : identifier || 'empty record id' )
53+ Sentry . set_tags ( 'mitlib.collection_ids' : relevant_ids . join ( '; ' ) )
54+ Sentry . capture_message ( 'Multiple Collection IDs found in ASpace record' )
55+ end
5256
5357 relevant_ids . first
5458 end
@@ -166,7 +170,9 @@ def date_range
166170 return unless @record [ 'dates' ]
167171
168172 # Some records have creation or publication dates that are ranges. Extract those here.
169- relevant_dates = @record [ 'dates' ] . select { |date | %w[ creation publication ] . include? ( date [ 'kind' ] ) }
173+ relevant_dates = @record [ 'dates' ] . select do |date |
174+ %w[ creation publication ] . include? ( date [ 'kind' ] ) && date [ 'range' ] . present?
175+ end
170176
171177 # If the record has no creation or publication date, stop here.
172178 return if relevant_dates . empty?
@@ -176,9 +182,6 @@ def date_range
176182 # first.
177183 relevant_date = relevant_dates . first
178184
179- # We are only concerned with creation/pub dates that are ranges.
180- return unless relevant_date [ 'range' ] . present?
181-
182185 "#{ relevant_date [ 'range' ] [ 'gte' ] } -#{ relevant_date [ 'range' ] [ 'lte' ] } "
183186 end
184187
0 commit comments