Skip to content

Create SpotlightConfigurations on Institution create

After #369 (closed) is complete...

In an after_create callback on the Institution model, we should create the relevant SpotlightConfiguration records.

For Institutions where their InstitutionGroup is of type k12, we need to create 4 SpotlightConfigurations, one for each of the allowed_view_types.

For all other Institutions (non-k12), create only a single 'Deafult` SpotlightConfig.

Even if no InstitutionGroup is set, create a SpotlightConfig of type Default.

Edge Case: This is unlikely, but Institutions can change Institution Types, so theoretically we could get an institution that gets converted into a k12 type. I don't forsee this situation ever coming to pass, so let's ignore it. If an institution is switched to a k12 type, they'll always have a Default view!

Edited by Mike Kanning