Closed bkiahstroud closed 2 years ago
datePublished and dateDigitized should be changed to plain text fields so that YYYY values can be imported and exported without being converted. We don't have a need for these to be sortable beyond string sorting, so they can be stored in the repo as strings not datetimes. The edit form should also be a text input rather than a date picker.
dateOfSituation is currently a plain text field but should be converted to a datetime field to work along the same lines as dateCreated. Formats are: dateOfSituationIngest: YYYY or YYYY-MM-DD dateOfSituationDisplay: ex: approximately YYYY, or YYYY-YYYY dateOfSituation: YYYY-MM-DD (ex: 1950-12-31)
Values for dates are imported using dateOfSituationIngest and dateOfSituationDisplay. Bulkrax converts the value in dateOfSituationIngest to a YYYY-MM-DD format to store in dateOfSituation. It converts partial dates so that when sorted they go at the end of the list (YYYY-12-31 or equivalent). dateOfSituationIngest and dateOfSituationDisplay are exportable, and are never overwritten by the value in dateOfSituation field.
On this importer I created two works with dateOfSituationIngest values of YYYY and YYYY-MM-DD and dateOfSituationDisplay values with strings. The works created are giving this error:
F, [2022-05-25T17:21:19.886461 #10964] FATAL -- : [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc]
F, [2022-05-25T17:21:19.886493 #10964] FATAL -- : [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] ActionView::Template::Error (invalid date):
F, [2022-05-25T17:21:19.886577 #10964] FATAL -- : [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 4: <% next if (field.name == "dateOfSituation") && !presenter.attribute_to_html(:dateOfSituationDisplay).blank? %>
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 5: <% next if %w[dateCreatedIngest dateOfSituationIngest].include?(field.name) %>
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 6:
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 7: <% if (html = presenter.attribute_to_html(field.name.to_sym, field.display_options)).present? %>
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 8: <%= html %>
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 9: <% elsif presenter.inherits? %>
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] 10: <% inheritable_fields = (ScoobySnacks::METADATA_SCHEMA.secondary_display_fields & ScoobySnacks::METADATA_SCHEMA.inheritable_fields) %>
F, [2022-05-25T17:21:19.886593 #10964] FATAL -- : [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc]
F, [2022-05-25T17:21:19.886637 #10964] FATAL -- : [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] app/views/hyrax/base/_secondary_attribute_rows.html.erb:7:in block in _app_views_hyrax_base__secondary_attribute_rows_html_erb___3545996982412736577_522060' [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] app/views/hyrax/base/_secondary_attribute_rows.html.erb:2:in
each'
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] app/views/hyrax/base/_secondary_attribute_rows.html.erb:2:in _app_views_hyrax_base__secondary_attribute_rows_html_erb___3545996982412736577_522060' [f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] app/views/hyrax/base/_metadata.html.erb:22:in
_app_views_hyrax_base__metadata_html_erb_4004868817038060129_521860'
[f0a4a5d8-aeac-4fdb-b795-96989cfef2bc] app/views/hyrax/base/show.html.erb:19:in `_app_views_hyrax_base_show_html_erb1226286763378728241_521800'
Hmm this same error came up after removing the dateofSituationDisplay and dateofSituationIngest fields on a new importer with new works.
@rschwab I've tracked this down to the metadata schema. I'll be pushing up a fix soon
This works now, great work Kiah!
Ref #498
Summary
Similar to
dateCreated
(#498),dateDigitized
anddatePublished
will also throw errors on the edit form if they aren’t full dates (YYYY-MM-DD). This behavior appears to be coming from how Hyrax displays fields that use date picker inputsRelated thread in Slack: link
Proposed Solutions
Archived
1. “Sanitize” the values for `dateDigitized` and `datePublished` like we do for `dateCreated` (convert YYYY values into full dates) a. Con: exported data may not match imported data 2. Change the inputs on the Hyrax form from [date pickers](https://share.getcloudapp.com/bLuKdvJg) to raw text inputsAcceptance Criteria
datePublished
's form input is a text inputdateDigitized
's form input is a text inputdateOfSituation
's form input is a date pickerdateOfSituationIngest
property to Work modeldateOfSituationIngest
property to Collection modeldateOfSituationDisplay
property to Work modeldateOfSituationDisplay
property to Collection modeldateOfSituationIngest
are parsed into full dates (YYYY-MM-DD) and put intodateOfSituation