Closed isaabutaa closed 3 years ago
Visit the preview URL for this PR (updated for commit c8a7e63):
https://tcl-28-shopping-list--pr38-hk-ia-sort-shopping-e3l98g3z.web.app
(expires Fri, 27 Aug 2021 00:46:59 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Great job with this @hulyak @isaabutaa! I pulled down the branch and everything worked as expected when I added new items to my list.
I encountered a bug when I first opened my list, some items for my token weren't displaying at all, but they were all old items added a while ago that didn't contain all of the fields we now include (I think the one causing the issue is daysUntilPurchase, which wasn't included in older items). I deleted them from Firestore and added new items instead and all worked as expected. If it's ok with everyone, I'm happy to go back and filter through old items in Firestore on my own time and remove them so we don't run into this issue going forward.
Yes, I think we should clean up Firestore 😃 I tried to delete some of them, but couldn't check all.
My personal recommendation for getting the sorting correct would be to create a Map/Dict object to store the firestore query results, with that Map containing an array for each of our groups (soon, not soon, kind of soon, and inactive) (itself sorted alphabetically). But my JS practicum is wanting; not sure the best way to handle this idiomatically. @luisaugusto / @meganesu I would be interested to hear your feedback on the best JSish way to handle the interior sorting among these groups.
Just noting here that we realized the AC had already been met with the way the sorting worked already; disregard my last.
Description
daysUntilPurchase
👉 If an item'sdaysUntilPurchase
are in the soon category (<= 7 days) it will be near the top, and colored in green 👉 If an item'sdaysUntilPurchase
are in the kind of soon category ( between 7 - 30 days) it will be in the middle, and colored in orange 👉 If an item'sdaysUntilPurchase
are in the not soon category (between 30 - 40 days) it will be near the bottom, and colored in red 👉 If an item'sdaysUntilPurchase
are in the inactive category, it will be last in the list and have a background color of greydaysUntilPurchase
, and if that value is the same, they will be sorted alphabeticallySingleItem
component, to allow the screen reader to make a distinction on how soon to buy the item.aria-checked
attribute in the label tag to say if the checkbox is checked or not. If you hover over the element, it won't say if the checkbox is checked or not, but if you click on the element while inspecting the code, it will.daysUntilPurchase
withfrequency
value so that it is not saved as null when first added to the database (see line 55 in AddItem component)lastPurchasedDate
, and saved that in a separate variable, but we were unable to properly integrate with our logic when comparingdaysUntilPurchase
, so we ended up just using anelse
statement insteaddaysUntilPurchase
. We had hoped/expected that it would still be alphabetical, but it is primarily sorted bydaysUntilPurchase
, andname
second, so it won't always be alphabetically orderedRelated Issue
closes #12
Acceptance Criteria
Type of Changes
Updates
Before
After
Hover over elements to see accessibility attributes:
Sorted Items with color:
Enable voiceover on Mac:
Testing Steps / QA Criteria
git checkout hk-ia-sort-shopping-list
git pull
npm start
daysUntilPurchase
for that item