-
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
Calculate Next Purchase Date #31
Conversation
…d of a single date
…o handle logic
Visit the preview URL for this PR (updated for commit d721a14): https://tcl-68-smart-shopping-list--pr31-dg-sm-calculate-next-ldwgepl1.web.app (expires Sun, 17 Mar 2024 13:41:10 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 8cb5d089a99ba9972009993f4dd31796b0cbda84 |
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.
…llab-lab/tcl-68-smart-shopping-list into dg-sm-calculate-next-date
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.
Great job! Looks good to me
Description
getDaysBetweenDates
indates.js
to use withcalculateEstimate
calculateEstimate
from@the-collab-lab/shopping-list-utils
modulefirebase.js
to calculate thenextPurchaseDate
for an itemnextPurchaseDate
inside of theupdateItem
function infirebase.js
Related Issue
closes #11
Acceptance Criteria
dateNextPurchased
property is calculated using thecalculateEstimate
function and saved to the Firestore databasedateNextPurchased
is saved as a date, not a numbergetDaysBetweenDates
function is exported fromutils/dates.js
and imported intoapi/firebase.js
Type of Changes
New Feature
Updates
Before
No changes to UI were made, no images can be provided for our changes.
Testing Steps / QA Criteria
dateNextPurchased
and the most recentdateLastPurchased
dateNextPurchased
, verify that nextPurchaseDate is updated to a future date based on estimate.calculateEstimate
works by weighing the number of purchases and the previous estimate against the time since last purchased. For example, the higher the number of total purchases is, the more the new estimate will be based off of previous purchases.If you would like a better understanding of how the
calculateEstimate
function works, check out this source on calculateEstimate