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

[BUG] Users cannot change the answer for a statement faster than a second due to createAt() filter limits #168

Open
acao22 opened this issue Jul 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@acao22
Copy link
Collaborator

acao22 commented Jul 23, 2024

Describe the bug
If users toggle answers faster than 1 second, then a duplicate of that statement appears in the list of statements. This is because we are now filtering by createAt(), which only records up to the second (an example is 2024-07-19 08:11:03). So if a user clicks multiple times in one second, the createAt() time is the same for both entries so both entries are displayed.

Possible solutions:

  1. We could add milliseconds to createAt() somehow
  2. We could filter first by createAt(), then by id -- but that's assuming id is unique and correct chronologically
  3. We could leave it for now, as users changing answers faster than a second is probably not too common

To Reproduce
Steps to reproduce the behavior:

  1. Go to Dashboard -> Answers
  2. Click on 'Edit your answers' and toggle any toggle for a specific statement

Expected behavior
It shouldn't show duplicate statements, no matter how fast the user toggles.

Screenshots
image
Toggled "others agree" for "Balls are round" too fast, so the statement appears twice

Additional context
This bug came up as a result of changing the filter for the latest answer for a statement per user to createAt() instead of id, which is better practice but has some limitations.
Related issues and PRs:

  1. Change /getanswers to filter based on createTime and also fix multiple toggle bug #165
  2. 165 Filter statements by createAt() and also fix toggling multiple answers not updating properly #166
  3. 128 change answers #157
@acao22 acao22 added the bug Something isn't working label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant