rubyforgood / casa

Volunteer management system for nonprofit CASA, which serves foster youth in counties across America.
https://casavolunteertracking.org/
MIT License
314 stars 478 forks source link

CaseContact status enum changes #5975

Closed thejonroberts closed 2 months ago

thejonroberts commented 3 months ago

What github issue is this PR for, if any?

No issue: syntax changes only. None of this is necessary.

While working on CaseContacts, I noticed the status enum was defined oddly. I started poking around. The enum is used to define .active?/.started? and not much else - doesn't use any of the other methods or scopes that come along with an enum definition. It is also a string column, which is atypical. That is for easy compatibility with the wicked wizard form steps - but standard integer column would make for faster queries.

What changed, and why?

The main thing I wanted to do is define the enum in a way that makes sense. But then I kept going to see if we could better use the enum, and set things up for a transition to integer column. That won't be necessary until performance is a real-world concern. It would require migrating existing data, which could be delicate. But these changes would enable it. The definition & wizard form updates would work if the enum column was changed to an integer type.

How is this tested? (please write tests!) 💖💪

Current specs. Could add/modify specs for each of the enum-created scopes, will probably look at that a bit, especially if people want to do this. I think the scope changes in specs are enough?