i think it would make sense to simplify the vote count related features.
instead of calculating them on the fly it would be good enough to have basic columns for these values on the clip table and just update them if a vote changes with the current rules
this would move the calculation cost to the vote update instead of the clip read and would simplify the scopes (as they would not exist anymore lol)
we would need a archived_at column though as we would not be able to use them for this check anymore
we could even go so far and move the entire calculation to a background job if we dont care about a few minutes of desync but with a event or observer we can directly update that if any vote related update happens anyway, we can also do both and trigger a debounced job for each clip that has vote changes if we want to.
i think it would make sense to simplify the vote count related features.
instead of calculating them on the fly it would be good enough to have basic columns for these values on the clip table and just update them if a vote changes with the current rules
this would move the calculation cost to the vote update instead of the clip read and would simplify the scopes (as they would not exist anymore lol)
we would need a archived_at column though as we would not be able to use them for this check anymore
we could even go so far and move the entire calculation to a background job if we dont care about a few minutes of desync but with a event or observer we can directly update that if any vote related update happens anyway, we can also do both and trigger a debounced job for each clip that has vote changes if we want to.