Skip to content

Week 4: Claudia & Michelle (As a user, I want to be alerted when I’m entering an item that is the same as something already on my list so I can avoid duplicate items)

ClaudiaStar edited this page Dec 5, 2019 · 10 revisions

AC:

  • Show an error message if the user tries to submit a new item that has the exact same name as an existing item
  • Show an error message if the user tries to submit a new item that has the same name as an existing item, where capitalization and punctuation have been normalized

12/3

Before item gets sent to db we are lower-casing the string, so only lower case items get saved. Wrote test to check if only lower case items were being listed on items page.

Next up will be to normalize punctuation on item and then test that as well. After that we will check for any duplicate items on list and show an error message if there it is an duplicate item. In theory because we are normalizing item before it's sent to DB, we should be able catch any capitalization or punctuation differences.

12/4

  • Created a for loop that iterates through the item name and removes all special characters, then wrote a passing test.
  • Checking for duplicates: Modified addItem function -> (1)Set document ID to equal item name. (2)Created a reference path to document to minimize repetitive code. (3) Used .exists firestore method to check whether new item is in DB. (4) Set an alert if exists, & added item to DB if not. *Turned duplicate item alert into popup message. Wrote final test to make sure said message pops up when duplicate items are entered!!!

Main resources used so far:

Firestore: get data once

Clone this wiki locally