Cant' complete subtasks in salon appointment scheduler project

Hello, I can’t complete the subtasks 1.1:15 and 1.1:16

1.1:15: You should display a numbered list of the services you offer before the first prompt for input, each with the format #) <service> . For example, 1) cut , where 1 is the service_id

1.1:16: If you pick a service that doesn’t exist, you should be shown the same list of services again

despite showing well when I run the script, everything else is working fine.
I guess it is just a matter of syntax.
Here is the part of my code concerned:

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

  echo -e "\nWhat service do you want?\n"

  GET_SERVICE=$($PSQL "SELECT service_id, name FROM services")
  
  echo "$GET_SERVICE" | while read SERVICE_ID BAR SERVICE_NAME
  do
    echo "$SERVICE_ID) $SERVICE_NAME"
  done
  
  read SERVICE_ID_SELECTED

  case $SERVICE_ID_SELECTED in
    1) SERVICE 1 ;;
    2) SERVICE 2 ;;
    3) SERVICE 3 ;;
    *) MAIN_MENU "Please enter a valid option."
  esac
}

Thank you.

Can you share the full script and a dump of your database @priseinversee - I can take a look when I get a chance.

Here is my git repo with my code GitHub - priseinversee/salon-appointment-scheduler-project
I feel stupid because I know it is probably just a matter of syntax, i’ve tried some different ones but couldn’t figure it out :frowning:
Thank you.

There are still bugs in these courses, I think you found a rare one. The tests can’t handle the +'s in the names of your services. I removed those and the tests all passed.

I wouldn’t have find this alone, thank you for helping me out

1 Like