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

165 Filter statements by createAt() and also fix toggling multiple answers not updating properly #166

Merged
merged 5 commits into from
Jul 19, 2024

Conversation

acao22
Copy link
Collaborator

@acao22 acao22 commented Jul 19, 2024

165 Filter statements by createAt() and also fix toggling multiple answers not updating properly
This closes issue #165 that I added, which also explains this PR pretty well but here are the things that I did:

  1. Fixed bug where if users toggle multiple answers at once across I_agree and others_agree, only one of the columns updates. This was due to a setState error in my code, so I fixed it by changing currentAnswer to update its value for I_agree and others_agree accordingly before sending data to the database
  2. Changed the filtering for /getanswers and /getAgreementPercentage to filter based on createAt() instead of id, which is better practice
  3. Bug that I noticed: 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. I think to fix this, we could add milliseconds to createAt() or filter based on a different way -- will ask Mark about this
    Pasted Graphic

@acao22 acao22 requested a review from amirrr July 19, 2024 10:56
amirrr
amirrr previously approved these changes Jul 19, 2024
Copy link
Collaborator

@amirrr amirrr left a comment

Choose a reason for hiding this comment

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

Looks good

server/routes/answers.js Outdated Show resolved Hide resolved
server/routes/results.js Outdated Show resolved Hide resolved
Copy link

cypress bot commented Jul 19, 2024

Passing run #86 ↗︎

0 11 0 0 Flakiness 0

Details:

165 Filter statements by createAt() and also fix toggling multiple answers not u...
Project: Commonsense Commit: 1b1150f07e
Status: Passed Duration: 00:41 💡
Started: Jul 19, 2024 5:24 PM Ended: Jul 19, 2024 5:25 PM

Review all test suite changes for PR #166 ↗︎

@acao22 acao22 added the bug Something isn't working label Jul 19, 2024
@acao22 acao22 self-assigned this Jul 19, 2024
@acao22 acao22 requested a review from amirrr July 19, 2024 17:21
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

Successfully merging this pull request may close these issues.

Change /getanswers to filter based on createTime and also fix multiple toggle bug
2 participants