-
Notifications
You must be signed in to change notification settings - Fork 1
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
Issue #9 - Marking item as purchased #28
Conversation
…hanged updateItem function in firebase
Visit the preview URL for this PR (updated for commit bcbc9bb): https://tcl-68-smart-shopping-list--pr28-dg-ap-purchase-item-bslrsggv.web.app (expires Sun, 10 Mar 2024 19:19:13 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 8cb5d089a99ba9972009993f4dd31796b0cbda84 |
…c purchaseItem function into changeHandler and removed useEffect
…ved async purchaseItem function into changeHandler and removed useEffect" This reverts commit d5688d8.
…c purchaseItem function into changeHandler and removed useEffect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work, this absolute seemed like a tricky issue to solve and I like the way you two went about doing just that. Added a question about the timer, but things look good to me overall!
d8346dc
…feect to use remaining time in setTimeout
Co-authored-by: Raynaldo Sutisna <[email protected]>
Thanks for the update. Good job! |
Description
This PR enables a user to mark a list item as purchased and initiates a timer to uncheck a purchased item after 24 hours so they may buy it again.
updateItem
function in thefirebase.js
APIinput
next to each list itemsetTimeout
used to uncheck a purchased item after 24 hoursuseState
to determine if an item has been checked and callupdateItem
functionRelated Issue
Closes #9
Acceptance Criteria
ListItem
component renders a checkbox with a semantic<label>
.dateLastPurchased
andtotalPurchases
properties on the corresponding Firestore documentupdateItem
function infirebase.js
has been filled out, and sends updates to the firestore database when an item is checkedType of Changes
New feature
Updates
Before
After
Testing Steps / QA Criteria
totalPurchases
anddateLastPurchased
.totalPurchases
has increased by one and that thedateLastPurchased
has been updated to the current date and time.totalPurchases
by one, and updatesdateLastPurchased
tonull
.dateLastPurchased
to more than a day previous. Confirm that upon List page refresh, the item is unchecked ifdateLastPurchased
is more than a day prior.