Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Based Near property oddities #43

Open
1 of 4 tasks
Tracked by #39
ShanaLMoore opened this issue Jun 28, 2024 · 4 comments
Open
1 of 4 tasks
Tracked by #39

🐛 Based Near property oddities #43

ShanaLMoore opened this issue Jun 28, 2024 · 4 comments
Assignees
Labels
allinson flex amigos bug something isn't working

Comments

@ShanaLMoore
Copy link

ShanaLMoore commented Jun 28, 2024

Summary

  • ON MAIN - A user is able to add a location to a work.
  • ON FLEXIBLE
    • With flexible false:
      • - the entry field doesn't load until you click to add another location
      • - the uri is rendered in the UI instead of the indexed label (fixed here)
    • With flexible true:
      • a user is unable to add a location... it attempts to save the full object instead of a uri (see notes)
      • the entry field doesn't load until you click to add another location

Details

ON MAIN - A user is able to add a location to a work.

image

Add new work > pick a work type
Add required fields. Click 'Additional Fields'
Find the location property. In the drop down, type in a city name. Select one from the auto populated list.
Submit the work

Based_near will be displayed on the work's show page.

image

Click to edit the work.
The location property will display the selected city:

image

ON flexible_double_combo ...

  • (spec/forms/hyrax/forms/resource_form_spec.rb is failing the based_near context in flexible_double_combo but passes on main)

How it looks when saved:

image

We noticed that the params look weird after the form get validated here. Diff from main is that it includes several #<ActionController::Parameters within the nested params. Is that a problem?

Screenshot 2024-06-28 at 10 05 08 AM

Dev Notes

Make sure geonames is configured. Otherwise, the drop down will not find any results.

In .koppie/config/intitializers/hyrax.rb update the following to:

  config.geonames_username = ENV['GEONAMES_USERNAME'] || 'scientist'

This diff Avoids the error about invalid type when saving based_near property on flexible_double_combo. I'm not sure if it's the correct approach. Related PR

image

@ShanaLMoore ShanaLMoore changed the title Based Near property oddities 🐛 Based Near property oddities Jun 28, 2024
@ShanaLMoore ShanaLMoore added bug something isn't working amigos allinson flex labels Jun 28, 2024
@kirkkwang
Copy link

kirkkwang commented Jul 1, 2024

Currently, the Based Near that shows up on the show page should be Location and reads from based_near_label solr property

@laritakr
Copy link

laritakr commented Jul 2, 2024

The problem is in the form in works_controller_behavior method build_form. The form being built and validated doesn't have a location object so it validates and updates the form incorrectly.

when the form goes to validate @fields contains

   "based_near"=>
   #<ActionController::Parameters {"0"=>#<ActionController::Parameters {"hidden_label"=>"Northern Europe, ", "id"=>"https://sws.geonames.org/7729883/", "_destroy"=>""} permitted: false>} permitted: false>,

The form needs to contain

   "based_near"=>[#<Hyrax::ControlledVocabularies::Location:0x67944 ID:_:g413400>],

The initial build of the form should include the based_near location object. In our branch it doesn't.

In Hyrax::FormFactory, prepopulate! is not filling in the value for based_near in the call to Valkyrie's change_set

@laritakr
Copy link

laritakr commented Jul 5, 2024

Tabled for now as a known bug, to work on higher priority issues.

@ShanaLMoore ShanaLMoore assigned orangewolf and unassigned laritakr Jul 16, 2024
@laritakr
Copy link

Some of the above issues may have been resolved by based_near work in Hyrax.

However some specific logic for based_near in the form is currently included via the dynamic loading of BasicMetadataFormFieldsBehavior in lib/hyrax/form_fields.rb, based on the inclusion of the basic_metadata schema.

This behavior is being included explicitly in Hyku as needed, via module BasedNearFormFieldsBehavior. Flexible metadata will require similar logic to handle the location terms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allinson flex amigos bug something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants