Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vote datetime to vote DB model #172

Open
tohuynh opened this issue Mar 9, 2022 · 3 comments
Open

Add vote datetime to vote DB model #172

tohuynh opened this issue Mar 9, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@tohuynh
Copy link
Collaborator

tohuynh commented Mar 9, 2022

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.

@tohuynh tohuynh added the enhancement New feature or request label Mar 9, 2022
@Shak2000
Copy link
Contributor

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?

@tohuynh
Copy link
Collaborator Author

tohuynh commented May 23, 2022

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.

@evamaxfield
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants