-
Notifications
You must be signed in to change notification settings - Fork 10
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
Persist user selection option refresh #57
Comments
How should this be implemented? Should the server send an |
If this is implemented I think there should also be a change vote feature. I have used the fact that user selection isn't saved after refresh to change my selection in class. Bug turned feature 😆 |
Aren't you always able to change your selection as long as voting is open? 🤔 |
Maybe you mean untick your vote? |
Did not know that, I am also very new to this uni and I couldn't figure it out in the few times I used it. I also might be confusing mathematize polls with this here. |
There are ongoing issues with the server not accepting votes due to heavy traffic, and currently the client doesn't show any feedback in that scenario; the clicks just get ignored. But I have definitely been able to change my vote in the past. |
Yes, untick the vote in order to change the selection. |
I can confirm that mathematize polls don't save your selection after a refresh. That would have to be reported to mathematize's maintainer Prof. Herman |
For the PollVoting, I believe you can change your vote (iirc), but you cannot untick your vote. So if this is true, maybe can we close #72? |
This might have been the case, and when that happened I refreshed the page to select a new vote. |
That's correct. |
Closed #72, sorry for all the confusion. |
No problem, we are glad that you bring up your concern ! |
@embeddedt I see that you have a great idea here: maybe the frontend wants to show some warnings if the vote is not received by the server. Do you want to create a new issue for that? |
Sure! #73 |
Would it be a bad idea to do both? Yes, it's a bit redundant but it does ensure the old vote displays on page load rather than on socket connection and it has the benefit of ensuring sync with the server in case of a discrepancy. Would work like this:
|
It does speed up reloading a little bit, but I'm not sure it's worth the extra infrastructure to start saving votes locally. If the page is being loaded from the server anyway, the socket connection should be pretty fast. |
I'm not sure how reliable the speed of the socket connection is for establishing a connection, especially under a high server load. I think users will try to vote when the page loads and not wait for the second it takes to update. This ties in with #73 where the UX might be negatively affected by slow server response. |
I don't think we should save the votes locally. Ideally, it should just be on the initial page load (with useEffect to obtain the vote (if the student voted) when a connection is established with the socket)). It'll be similar to the way how the vote data is obtained when a professor refreshes their page but the vote data still persists. However, for this case, we can probably get the info from the socket rather from an API call. (See https://github.com/utmgdsc/PollVotingSystem/blob/main/client/src/pages/VoteControls.tsx#L37) I don't think the socket currently sends back with whatever the student voted (on the initial connection when joining a poll), so perhaps @shubhbapna can shine a bit more light onto the server for that. |
Yes currently there is no way for students to get to know what they voted on after a refresh. Given how high traffic is already causing issues with the server, I don't want to add an additional load for the server to get the student's vote on the initial connection. However, if @hiimchrislim agrees, we could implement this completely on the frontend. Just store the most recent vote (probably pollId and the question id) in |
If the socket connection is too slow we could possibly just enable the loading animation from #74 until it connects. |
Describe the bug
When a student refreshes their page after voting, their selected option should still persist. (Seems like we forgot to add this in at the time)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The student vote should persist on a page refresh
The text was updated successfully, but these errors were encountered: