Allocations for child resources can depend on parent resource data
So (I think) when you set about allocating a child resource, you must first get the Institution List values from its parent resource record. That is, unless the child record already has data there.
Also...
When a parent record's Allocations are changed, the Allocation of a child record will (may?) need to be changed accordingly.
So...
- migration to add self join. see: https://guides.rubyonrails.org/association_basics.html#self-joins
- modify Resource view to show relation (link)
- modify Resource DOOR Importer to set parent relation for Resources whose
resource_code
values contain a:
- Callback on parent Resource to handle the 'trickling down' of adding/removing allocations
- Consider: ProQuest Newspapers is a parent Resource of NYT. On ingest, Allocations are created for the NYT resource that match those of its parent. Later, the Allocations for ProQuest Newspapers are modified. The Allocation of all children of the parent need to be modified in accordance with the parent. Say Institution X is 'unassigned' to ProQuest Newspapers. Whenever this happens, NYT should also be unassigned from Institution X.
Edited by Mike Kanning