samvera / questioning_authority

Question your authorities
Other
54 stars 30 forks source link

`active` isn't surfaced in #all, causing unnecessary #find calls #149

Closed revgum closed 7 years ago

revgum commented 7 years ago

https://github.com/samvera/questioning_authority/blob/master/lib/qa/authorities/local/file_based_authority.rb#L17

If we surface the active flag, this would allow the caller to handle selecting the terms much more efficiently. Possibly defaulting to true if active doesn't exist in the yml file.

res[:active] = true if res[:active].nil?
{ id: res[:id], label: res[:term], active: res[:active] }.with_indifferent_access

This would make the additional #active? in Hyrax unnecessary and speed up handling large local authorities. https://github.com/samvera/hyrax/blob/master/app/services/hyrax/qa_select_service.rb#L30