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

Issue #13: Sort Items by Purchase Urgency #30

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dterceroparker
Copy link
Member

@dterceroparker dterceroparker commented Sep 16, 2024

Description

This feature sorts shopping list items by urgency to help users plan their purchases. Items are grouped into:

  • Due soon (7 days or fewer)
  • Due kind of soon (7–30 days)
  • Not due soon (30+ days)
  • Overdue (0-60 days since predicted next purchase date)
  • Inactive (60+ days since last purchase)

Changes

  • Added urgency indicators to each item without relying solely on color.
  • Implemented comparePurchaseUrgency in dates.js to:

Sort inactive items last.
Sort items by days until purchase.
Sort items alphabetically if urgency is the same.
Overdue items (past their purchase date but not inactive) are sorted to the top.
Overdue items are indicated in the UI.

Related Issue

Closes #13

Acceptance Criteria

  • Items in the list are shown with an indicator that tells the user they should buy the item “soon”, “kind of soon”, or “not soon”; or that the item is “inactive”
  • This urgency indicator does not rely on only color
  • api/firestore.js exports a new comparePurchaseUrgency function with the following behaviors
  • sorts inactive items last, then
  • sorts items in ascending order of days until purchase, and
  • sorts items with the same days until purchase alphabetically
  • If you complete all of the previous acceptance criteria, consider what happens when an item’s dateNextPurchased has passed, but it isn’t yet inactive. Let’s call that item “overdue”.
  • Extend the functionality of comparePurchaseUrgency to sort “overdue” items to the top of the list
  • Indicate in your UI when an item is overdue

Type of Changes

Enhancement
Feature
Accessibility

Updates

After

Screen Shot 2024-09-18 at 2 05 32 PM

Testing Steps / QA Criteria

  • Please log in using your Gmail credentials
  • We have shared the SortTest list which should appear on the Home page

SortTest list reflects all urgency categories. Please examine that they are ordered from (bottom to top) inactive, not soon, kind of soon, due soon, and overdue.

  • Please feel free to experiment with your own lists to verify that purchasing an item changes its urgency.

export function comparePurchaseUrgency

dates.js: update param name and logic to handle future and past dates

List.jsx: import comparePurchaseUrgency
Copy link

github-actions bot commented Sep 16, 2024

Visit the preview URL for this PR (updated for commit 6307f89):

https://tcl-74-smart-shopping-list--pr30-dtp-nr-sorting-d0os35i8.web.app

(expires Wed, 25 Sep 2024 17:54:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 79d73546692f99aad8468c28e36db434e2c190ac

@dterceroparker dterceroparker changed the title Issue #13: Implement sort list by purchase history Issue #13: Implement Sort List by Purchase Date Urgency Sep 16, 2024
NickRoccodev11 and others added 3 commits September 16, 2024 16:08
filter shopping list to separate out past purchase dates and pending purchase dates into two lists

append the lists to eachother so overdue dates come first
…ping list items based on urgency

Categories are: inactive, overdue, and future.

Overdue items appear first, followed by future dates, and finally inactive items.
@dterceroparker dterceroparker changed the title Issue #13: Implement Sort List by Purchase Date Urgency Issue #13: Sort Items by Purchase Urgency Sep 18, 2024
@dterceroparker dterceroparker added accessibility enhancement New feature or request labels Sep 18, 2024
@dterceroparker dterceroparker marked this pull request as ready for review September 18, 2024 18:16
Copy link
Contributor

@stacy-tech stacy-tech left a comment

Choose a reason for hiding this comment

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

I tested it, and everything is functioning as expected. The urgency indicator works well, and updates the items purchase urgency time smoothly- great job guy! 🎉

Copy link
Collaborator

@shuveksha-tuladhar shuveksha-tuladhar left a comment

Choose a reason for hiding this comment

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

@NickRoccodev11 @dterceroparker Great work! The functionality is excellent. For the UI, perhaps we could revisit the color choices that may work for both dark and light modes to improve visibility, especially in the lighter mode. We could consider creating an issue to address this in the future.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility enhancement New feature or request
Projects
None yet
4 participants