Salon Appointment Scheduler - Build a Salon Appointment Scheduler - CodeRoad don't work!

Tell us what’s happening:
In VM (CodeAlly), so far my progress stucked in multiple steps in the .sh file but is very strange because locally I completed the test one time.

I saw the similar post with the following solution, but it didn’t work for me:

"There is a problem with the tests on this particular course I think. I had the same issue recently but eventually, after I’d spammed the ‘Run’ button many times, all of the tests suddenly passed and I was able to complete the project.

I spoilered your code, only because it’s likely a full solution to the project."

I tried changing the browser and connection for hours but absolutely nothing.

Thank you if someone have another solution for me! Thanks for your attention.

Your code so far

#! /bin/bash
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?\n" 

#main menu
MAIN_MENU(){
  if [[ $1 ]]
  then
    echo -e "\n$1"
  fi

  SERVICES_LIST=$($PSQL "SELECT service_id, name FROM services")
 
  #show list of services
  echo "$SERVICES_LIST" | while read SERVICE_ID BAR SERVICE
  do
    echo "$SERVICE_ID) $SERVICE"
  done
 #get service requested
  echo "which service?"
  read SERVICE_ID_SELECTED

  #check if SERVICE_REQUESTED is a number
   if [[ ! $SERVICE_ID_SELECTED =~ ^[0-9]+$ ]]
    then  
    MAIN_MENU "I could not find that service. What would you like today?"
    else
  #get SERVICE_NAME if one exists
  SERVICE_NAME=$($PSQL"SELECT name FROM services WHERE service_id=$SERVICE_ID_SELECTED")
  #check is a SERVICE_NAME exisits
  if [[ -z $SERVICE_NAME ]]
  then
    #If not then return to the main menu
    MAIN_MENU "I could not find that service. What would you like today?"
  fi

  echo -e "\nWhat's your phone number?"
  read CUSTOMER_PHONE

  CUSTOMER_ID=$($PSQL"SELECT customer_id FROM customers WHERE phone='$CUSTOMER_PHONE'")
  if [[ -z $CUSTOMER_ID ]]
  then
    echo "I don't have a record for that phone number, what's your name?"
    read CUSTOMER_NAME
    INSERT_CUSTOMER_RESULT=$($PSQL "INSERT INTO customers(name, phone) VALUES('$CUSTOMER_NAME', '$CUSTOMER_PHONE')")
    CUSTOMER_ID=$($PSQL"SELECT customer_id FROM customers WHERE name='$CUSTOMER_NAME'")
  else
   CUSTOMER_NAME=$($PSQL"SELECT name FROM customers WHERE phone='$CUSTOMER_PHONE'")
  fi
  
  echo -e "\nWhat time would you like your$SERVICE_NAME,$CUSTOMER_NAME?"

  read SERVICE_TIME
  INSERT_APPOINTMENT=$($PSQL "INSERT INTO appointments(customer_id, service_id, time) VALUES($CUSTOMER_ID, $SERVICE_ID_SELECTED, '$SERVICE_TIME')")

 echo -e "\nI have put you down for a$SERVICE_NAME at $SERVICE_TIME, $CUSTOMER_NAME."

    fi

}

MAIN_MENU

Your browser information:

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

Challenge: Salon Appointment Scheduler - Build a Salon Appointment Scheduler

Link to the challenge:

is correct use:

PSQL=“psql -X --username=freecodecamp --dbname=salon --tuples-only -c”

?

1 Like

Nobody can help me or give me an advice ? :slight_smile:

I can’t give advice, but can confirm that I am having the same issue. My solution passes all tests when I run it locally, but fails the ones related the the script querying the database. I suspect there is something wrong with the tests themselves and how they are validating the results for tests 15, 16, and 18-21.

I would assume this is related to the timeout issue discussed in my post:

To verify if this is the case, you can try and execute the following in the command-line in CodeAlly, and then run the tests again:

sed 's/1000/10000/' -i /home/codeally/project/.freeCodeCamp/test/utils.js

This will modify utils.js to use the a timeout of 10 second instead of 1 second.

Hi,

yes, several people had a similar issue, I tried every solution but it didn’t work.

I have no other ideas :face_exhaling:

Thank you for your help!

I tried but nothing changed :frowning:

@colaiera You did the command wrong. ^-^’
Try and copy it again, the output of your terminal showed an error because you forgot the final / in the sed command.

It’s 's/1000/10000/' not 's/1000/10000'.

THIS WORKS! Thank you a lot!