Since committees do a join with officers when specifying the active field, the officers field is being appended to the committees results.
We only want the commitees' fields, and not those of the officers, so this excludes the officers attributes.
Unfortunately, the id attribute of the officer cannot be excluded on the include (because sequelize requires it), so duplicates are still being returned when requesting the active scope when there are multiple officers in one committee.
The changes in routes/commitees.js resolve this, but aren't the prettiest (and ideally we can resolve this in a different way)
Since committees do a join with officers when specifying the active field, the officers field is being appended to the committees results.
We only want the commitees' fields, and not those of the officers, so this excludes the officers attributes. Unfortunately, the id attribute of the officer cannot be excluded on the include (because sequelize requires it), so duplicates are still being returned when requesting the active scope when there are multiple officers in one committee.
The changes in
routes/commitees.js
resolve this, but aren't the prettiest (and ideally we can resolve this in a different way)