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

Marking shopping list items as purchased #25

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

Wyna-7
Copy link
Collaborator

@Wyna-7 Wyna-7 commented Sep 5, 2024

Description

User can now check items as purchased on their lists, updating the firestore information on the item and unchecking automatically after 24h of purchase.

Related Issue

Closes #9

Acceptance Criteria

  • The ListItem component renders a checkbox with a semantic <label>.
  • Checking off the item in the UI also updates the dateLastPurchased and totalPurchases properties on the corresponding Firestore document.
  • The item is shown as checked for 24 hours after the purchase is made (i.e. we assume the user does not need to buy the item again for at least 1 day). After 24 hours, the item unchecks itself so the user can buy it again.
  • The updateItem function in firebase.js has been filled out, and sends updates to the firestore database when an item is checked.

Type of Changes

feature

Updates

Before

image

After

image

Testing Steps / QA Criteria

  • Do a git checkout hm-qg-updateItemPurchasedState and git pull.
  • Open the homepage by running npm start.
  • Navigate to List, each item should have a checkbox before it.
  • Checking one of the checkboxes should update the checked and dateLastPurchased fields for the item on firestore.
  • To confirm the unchecking after 24h works as expected, manually modify the dateLastPurchased to one day prior and one minute forward. Wait until the time condition is met and reload the page: the checkbox should now be unchecked.

Copy link

github-actions bot commented Sep 5, 2024

Visit the preview URL for this PR (updated for commit 44635e0):

https://tcl-79-smart-shopping-list--pr25-hm-qg-updateitempurc-veexd9kn.web.app

(expires Thu, 12 Sep 2024 09:53:34 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: d91d9ddbda780208241c52942f544acf8e81407a

Copy link
Collaborator

@Tomiogunsan Tomiogunsan left a comment

Choose a reason for hiding this comment

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

Great work guys!

Copy link
Collaborator

@joriordan332 joriordan332 left a comment

Choose a reason for hiding this comment

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

Looks great guys! Well done on what looked like such a tricky issue this week

@Hudamabkhoot Hudamabkhoot merged commit 1ae8026 into main Sep 6, 2024
2 checks passed
@Hudamabkhoot Hudamabkhoot deleted the hm-qg-updateItemPurchasedState branch September 6, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants