-
Notifications
You must be signed in to change notification settings - Fork 0
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
Eb ar estimate next purchase date issue 11 #28
Conversation
…n whole numbers. checkboxes are not staying checked. need to get dateLastPurchased and dateNextPurchased running.
…s correctly updating dateLastPurchased and totalPurchase
… field fills with a date thats calculated using calculateEstimate function
Visit the preview URL for this PR (updated for commit 689220a): https://tcl-76-smart-shopping-list--pr28-eb-ar-estimate-next-dg99jllp.web.app (expires Mon, 23 Sep 2024 20:46:05 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 512b1a88be8ae05fd3e727b99332819df760271d |
- Ensure dateLastPurchased is updated when an item is checked. - Update dateNextPurchased using getFutureDate function.
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.
Did some testing and everything is working. I went ahead and added an item and all the date props in firebase are updating correctly. When I check the item, dateNextPurchased
updates to the next day.
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.
Looks good! Really liked how organized and clean the code was. I was able to add an item, check the item, and dataNextPurchased
was saved to the next day in Firebase.
I was also able to mess around with the dates in Firebase (while also manually incrementing totalPurchases
), and was able to see varying dates saved in dateNextPurchased
based off what was saved to dateLastPurchased
.
src/components/ListItem.jsx
Outdated
updateItem(listPath, id, { | ||
...item, | ||
}) |
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.
nitpick ( non-blocking ): You can just pass in the item here now:
updateItem(listPath, id, { | |
...item, | |
}) | |
updateItem(listPath, id, item) |
src/api/firebase.js
Outdated
// We'll use the user's email as the document id | ||
// We'll use the user's emailƒ as the document id |
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.
praise (non-blocking): Always love typo cleanups!
src/components/ListItem.jsx
Outdated
console.error('Error updating item: ', error); | ||
}); | ||
console; |
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.
nitpick ( non-blocking | if-minor ): Should probably cleanup this stray console :)
console; |
src/utils/dates.js
Outdated
// import { calculateEstimate } from '@the-collab-lab/shopping-list-utils'; | ||
|
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.
nitpick ( non-blocking): And stray comment here
// import { calculateEstimate } from '@the-collab-lab/shopping-list-utils'; |
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.
Description
dateNextPurchased
fielddateNextPurchased
uses thecalculateEstimate
function that takes into consideration three arguments:previousEstimate
,daysSinceLastPurchase
, andtotalPurchases
to give the user a more tailored dateNextPurchased estimate.Related Issue
closes 11
Acceptance Criteria
Type of Changes
enhancement
Updates
Before
dateNextPurchased
is populated with a date that is days selected when adding an item (soon, kind of soon, not soon).After
dateNextPurchased
is populated with a date that calculates the user's shopping habits. If the user adds the item and checks it off immediately,dateNextPurchased
takes into account the user buying the item once and one day later, and how often the user purchases the item.Testing Steps / QA Criteria
eb-ar-estimate-next-purchase-date-issue-11
branchdateNextPurchase
anddateLastPurchase
dateNextPurchase
will be to the next day.