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

[Binni] Fix. save note not working after delete (#38) #47

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

droidbg
Copy link
Contributor

@droidbg droidbg commented Oct 2, 2023

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description/ RCA

The query used to fetch the notes was wrong.

The query running previously was
SELECT id, title, plain_text, created_at FROM Notes WHERE deleted != 1 and author_id = '17d8af20-6054-11ee-be82-b1b190fc05e2' or author_id = 'guest_user_id' ORDER BY created_at DESC'
This will select the notes even for which deleted is set to 1, because the operator precedence is wrong.

Fix

Changed the query and added brackets around author_id condition for precendency.
Now the query becomes:

SELECT id, title, plain_text, created_at FROM Notes WHERE deleted != 1 and (author_id = '17d8af20-6054-11ee-be82-b1b190fc05e2' or author_id = 'guest_user_id') ORDER BY created_at DESC'

Related Tickets & Documents

Tested Feature??

  • In Real Device.
  • In Emulator

@SankethBK could you please review it

Copy link
Owner

@SankethBK SankethBK left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you for contributing

@SankethBK SankethBK merged commit 634353f into SankethBK:master Oct 2, 2023
1 check passed
@SankethBK SankethBK added the hacktoberfest Applicable to hacktoberfest label Oct 2, 2023
@SankethBK
Copy link
Owner

Hey sorry I forgot to add hacktoberfest tag before merging. Let me know if it is not counted in your hacktoberfest PR's, we can revert and re-merge this

@droidbg
Copy link
Contributor Author

droidbg commented Oct 2, 2023

@SankethBK it is counted, Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Applicable to hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save Note not working after delete.
2 participants