Commit 21e4acf
Better error handling for dates
Why these changes are being introduced:
We encountered a bug after V2 launch in the normalization process,
during which Bento hits an unhandled nil value that breaks the
search results. This is because we are assuming every ASpace
record has a creation date, when in fact some of them have
publication dates instead.
Somewhat related to this is a transmogrifier bug that causes a
`kind` to be associated with a date even when there is no date.
Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/TIMX-211
* https://mitlibraries.atlassian.net/browse/TIMX-212
How this addresses that need:
This updates `NormalizeTimdex#extract_dates` to select as relevant
dates of either the 'creation' _or_ 'publication' date kind. It
also adds a guard clause to return if the `relevant_dates` array
is empty (a precaution that would have prevented this error).
Side effects of this change:
I removed a superfluous check for `date['kind'] == 'creation'` in
the guard clause in the `extract_dates` method that checks for
a date range. At this point in the method, we have already
confirmed that the relevant date is either a creation or publication
date.1 parent 535210d commit 21e4acf
File tree
4 files changed
+553
-6
lines changed- app/models
- test
- models
- vcr_cassettes
4 files changed
+553
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
39 | 81 | | |
0 commit comments