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

Dynamically update post score tooltip (#1207) #1224

Merged
merged 7 commits into from
Nov 12, 2023

Conversation

Oaphi
Copy link
Member

@Oaphi Oaphi commented Oct 23, 2023

This PR ensures the post score tooltips are updated on vote success. I opted for adding a new score field to the success response (re-finding the post is needed to get the updated score after the recalc_score method is run - if anyone has a better idea for doing so, I'd appreciate that).

Screencast.from.23.10.2023.04.16.50.webm

@Oaphi Oaphi self-assigned this Oct 23, 2023
@Oaphi Oaphi added area: ruby Changes to server-side code area: html/css/js Changes to front-end code complexity: easy Issues that should take limited effort to resolve/fix/build. labels Oct 23, 2023
@Oaphi Oaphi requested a review from a team October 23, 2023 01:14
@Oaphi Oaphi linked an issue Oct 23, 2023 that may be closed by this pull request
Copy link
Contributor

@Taeir Taeir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. I have no good solution for avoiding requerying the database for the updated score, but I do suggest to use the reload function to get the updated post attributes instead of using find to grab a new object.

app/controllers/votes_controller.rb Outdated Show resolved Hide resolved
app/controllers/votes_controller.rb Outdated Show resolved Hide resolved
Oaphi and others added 3 commits November 11, 2023 21:57
Applied from suggestion - part 1

Co-authored-by: Taico Aerts <t.v.aerts@tudelft.nl>
Applied from suggestion - part 2

Co-authored-by: Taico Aerts <t.v.aerts@tudelft.nl>
@Oaphi Oaphi requested a review from Taeir November 11, 2023 20:06
@Taeir Taeir merged commit f19abf0 into develop Nov 12, 2023
7 checks passed
@Taeir Taeir deleted the 0valt/1207/update-votes-tooltip branch November 12, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: html/css/js Changes to front-end code area: ruby Changes to server-side code complexity: easy Issues that should take limited effort to resolve/fix/build.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When updating live votes, also update the tooltip
2 participants