Skip to content

(W4) Nikema and Mike (Check Input Values if there are Duplicates in Database)

Nikema Prophet edited this page Jan 12, 2020 · 9 revisions

7. 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 #29

PR: https://github.com/the-collab-lab/tcl-3-smart-shopping-list/pull/53

AC:

  • 7.1 Show an error message if the user tries to submit a new item that has the exact same name as an existing item
  • 7.2 Show an error message if the user tries to submit a new item that has the same name as an existing item, where capitalization has been normalized and punctuation has been removed
  • 7.3 The user’s original input should be what gets saved in the database

Problem Solving (George Polya)

  • To solve a problem, ask these questions
    • What are the unknown aspects?
    • What do you know? What data do you have?
    • What constraints and what rules apply?

Sync January 6th

Overview

  • Greet
  • Review & Understand Story
  • Set Week Plan
  • Parking Lot (Things we brought up but not important)

Notes

input = input.replace(/[^a-zA-Z\s]/g, "").toLowerCase()
// will strip out all non-letters except whitespace, then lowercase the string

node repl

Questions

  • 7.3 The user’s original input should be what gets saved in the database. Whatever the originally put in the box gets saved but you check if doesn't match what is already on the list. Andrew?

Next Steps

  • 7.1 Mike
  • 7.2 Nikema
  • Nikema will create a branch and PR Draft ✅
  • We will meet again Wed @ 8pm
  • Maybe a little Cypress at the end of the week??
  • Maybe make this app a little prettier???

https://reactjs.org/docs/context.html


https://www.andreasreiterer.at/dynamically-add-classes/

https://reactjs.org/docs/faq-styling.html

Mike, another way to handle the error message is with conditional rendering. Something to think about?

https://blog.logrocket.com/use-hooks-and-context-not-react-and-redux/