impactoss / impactoss-server

IMPACT OSS - server-side application & API
https://demo.impactoss.org
MIT License
3 stars 8 forks source link

Use combined indicators for recommendations, categories, and their due dates #419

Open lukearndt opened 2 months ago

lukearndt commented 2 months ago

Context

https://github.com/impactoss/impactoss-server/issues/385

When direct recommendation-indicator relationships were introduced, the indirect relationships were initially lost. Those were needed to trigger overdue emails to category managers.

We put a workaround in place in #386 but recognised the need for a cleaner solution.

Changes

This commit tidies up the way that we source indicators for recommendations and subsequently for categories and their due dates.

Considerations

Initially I tried to create an ActiveRecord has_many on Recommendation that contained all of the indicators from both direct relations and those from the measures. Unfortunately I wasn't successful in getting that working; so far as I can tell it's not a supported behaviour.

Instead, I've used instance methods on the Category and Recommendation models to build the collections that we need for our current features.