Salon Appointment Scheduler - Tests not passing for adding rows

Tell us what’s happening:
All of the tests are passing, except for the two near the end about inserting the row into the appointments table. The inserts are working when I check the table, so I can’t figure out why the tests won’t pass. Any help would be gratefully received :slight_smile:

Your code so far

PSQL="psql --username=freecodecamp --dbname=salon --tuples-only -c "
echo -e "\n~~~~~ MY SALON ~~~~~\n"
echo -e "Welcome to My Salon, how can I help you?"
SERVICES() {

AVAILABLE_SERVICES=$($PSQL "SELECT * FROM services")
echo "$AVAILABLE_SERVICES" | while read SERVICE_ID BAR NAME
do
echo "$SERVICE_ID) $NAME"
done
}
SELECT_SERVICE() {

read SERVICE_ID_SELECTED 
CHECK_ID_VALID=$($PSQL "SELECT service_id FROM services WHERE service_id = $SERVICE_ID_SELECTED;")
echo "$CHECK_ID_VALID"
if [[ ! $CHECK_ID_VALID ]]
then
 echo "I could not find that service. What would you like today?" 
 SERVICES
 SELECT_SERVICE
fi
}
SERVICES
SELECT_SERVICE
GET_CUSTOMER_INFO() {
echo -e "What's your phone number?"
read CUSTOMER_PHONE
CUSTOMER_NUMBER=$($PSQL "SELECT phone FROM customers WHERE phone = '$CUSTOMER_PHONE'")

if [[ -z $CUSTOMER_NUMBER ]]
then
echo -e "I don't have a record for that phone number, what's your name?"
read CUSTOMER_NAME
INSERT_CUSTOMER=$($PSQL "INSERT INTO customers(phone, name) VALUES ('$CUSTOMER_PHONE', '$CUSTOMER_NAME');")
fi
CUSTOMER_NAME=$($PSQL "SELECT name FROM customers WHERE phone = '$CUSTOMER_PHONE'")
SERVICE=$($PSQL "SELECT name FROM services WHERE service_id = '$SERVICE_ID_SELECTED';")
echo "What time would you like your $(echo $SERVICE | sed -E 's/^ *| *$//g'), $(echo $CUSTOMER_NAME | sed -E 's/^ *| *$//g')?"
read SERVICE_TIME
CUSTOMER_ID=$($PSQL "SELECT customer_id FROM customers WHERE phone = '$CUSTOMER_PHONE'")
INSERT=$($PSQL "INSERT INTO appointments(customer_id, service_id, time) VALUES ('$CUSTOMER_ID', '$SERVICE_ID_SELECTED', '$SERVICE_TIME')")
echo -e "I have put you down for a $(echo $SERVICE | sed -E 's/^ *| *$//g') at $SERVICE_TIME, $(echo $CUSTOMER_NAME | sed -E 's/^ *| *$//g')."
 }
 
GET_CUSTOMER_INFO

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.76

Challenge: Salon Appointment Scheduler - Build a Salon Appointment Scheduler

Link to the challenge:

Can you post the text of the tests that are not passing?


Yes, here it is :slight_smile:

what is in the the appointments table after you run the script with the testcase values?

This is the appointments table after running the script with the testcase values:
Screenshot 2023-01-10 151712

did you manage to solve it? I’m having the same issue

Same issue here. All of my code and outputs are practically the same as @katie_walters

Please open a new topic and share any relevant code and db tables