Tell us what’s happening:
I did the entire project, it is running correctly, but from subtask 15 onwards it is not being validated, making it impossible to finish the project.
###Your project link(s)
solution: GitHub - 4ndre-pire5/learn-salon-appointment-scheduler
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0
Challenge Information:
Salon Appointment Scheduler - Build a Salon Appointment Scheduler
#!/bin/bash
PSQL=“psql -X --username=freecodecamp --dbname=salon --tuples-only --no-align -c”
echo -e “\n~~~~~ MY SALON ~~~~~\n”
MAIN_MENU(){
if \[\[ $1 \]\] then echo -e "\\n$1" else echo "Welcome to My Salon, how can I help you?" fi #get available services AVAILABLE_SERVICES=$($PSQL "SELECT service_id, TRIM(name) FROM services ORDER BY service_id") echo "$AVAILABLE_SERVICES" | xargs -L1 | while IFS='|' read SERVICE_ID SERVICE_NAME do echo "$SERVICE_ID) $SERVICE_NAME" done read SERVICE_ID_SELECTED SERVICE_NAME=$($PSQL "SELECT name FROM services WHERE service_id = $SERVICE_ID_SELECTED ") if \[\[ -z $SERVICE_NAME \]\] then MAIN_MENU "I could not find that service. What would you like today?" else APPOINTMENT_MENU fi}
APPOINTMENT_MENU(){
#get customer phone echo -e "\\nWhat's your phone number?" read CUSTOMER_PHONE CUSTOMER_NAME=$($PSQL "SELECT name FROM customers WHERE phone = '$CUSTOMER_PHONE'") #if customer name doesn't exist if \[\[ -z $CUSTOMER_NAME \]\] then #get new customer name echo -e "\\nI don't have a record for that phone number, what's your name?" read NEW_CUSTOMER_NAME #insert new customer INSERT_CUSTOMER_RESULT=$($PSQL "INSERT INTO customers (phone, name) VALUES('$CUSTOMER_PHONE', '$NEW_CUSTOMER_NAME')") CUSTOMER_NAME=$NEW_CUSTOMER_NAME fi #get service name SERVICE_NAME_FINAL=$($PSQL "SELECT name FROM services WHERE service_id = '$SERVICE_ID_SELECTED'") #ask for time appointment echo -e "\\nWhat time would you like your $SERVICE_NAME_FINAL, $CUSTOMER_NAME?" #verify time format while true; do read SERVICE_TIME if \[\[ $SERVICE_TIME =\~ ^(\[0-1\]\[0-9\]|2\[0-3\]):\[0-5\]\[0-9\]$ \]\] then break else echo -e "\\nTime not recognized. Please enter a time in HH:MM format." fi done #get customer id CUSTOMER_ID=$($PSQL "SELECT customer_id FROM customers WHERE phone = '$CUSTOMER_PHONE'") #insert new appointment INSERT_APPOINTMENT_RESULT=$($PSQL "INSERT INTO appointments (time, customer_id, service_id) VALUES('$SERVICE_TIME', '$CUSTOMER_ID', '$SERVICE_ID_SELECTED')") #show the appointment to user echo -e "\\nI have put you down for a $SERVICE_NAME_FINAL at $SERVICE_TIME, $CUSTOMER_NAME."}
MAIN_MENU