Add vote datetime to `vote` DB model
Feature Description
A clear and concise description of the feature you're requesting. Add vote datetime field to the vote DB model https://github.com/CouncilDataProject/cdp-backend/blob/main/cdp_backend/database/models.py#L698
Use Case
Please provide a use case to help us understand your request in context. The front end wants to be able to sort a person's voting record by vote datetime.
Solution
Please describe your ideal solution.
Alternatives
Please describe any alternatives you've considered, even if you've dismissed them.
I can look into it, but I need to understand something:Vote has a reference to Event, and Event has a datetime. Does this satisfy the requirement for having datetime accessible from Vote?
Vote has a reference to Event, and Event has a datetime. Does this satisfy the requirement for having datetime accessible from Vote?
It would, but the query to sort/filter a person's votes by the event's datetime would be inefficient, as the query would need to populate/fill in the Event for each Vote. Sorting/filtering votes by the event's datetime would force us to fetch all votes and populate the Event reference field for each vote(populating is just making a request to the database to fill in the reference field) and currently the database only allows a limited number of concurrent requests ( we have to make concurrent requests or the page will have high latency).
See the source of this issue.
Agree with To's writeup. The Vote having a reference to Event is not enough. For faster querying and direct filtering we need the vote_datetime on the Vote model.