Cannot get steps to complete in world cup database

I cannot complete the worldcup database project even tho all my code gets the correct results. I cant get any of the steps to show as complete. Here’s my repo: GitHub - AndrewKillion/worldcup

Im not sure if this error message when it the coderoad loads?

I’ve even tried the “last resort” option and reloaded all my code and it still didnt solve the problem. Any help would be great.

Complete this table first:


Add here NOT NULL:
image
like here:
image

Ah whoops.

I’ve added the not null constraint to all columns but its still not checking any boxes. but that SUBTASKS 1.1 error is still showing up.

Can you show us a larger screenshot showing the terminal too?

First of all, to start the project, you need to create the “worlcup” database.
Did you create it?
But still, did you create a separate repository for this project?.
Why does “games csv” appear in your project?
Where did the “expected output.txt” come from?
Normally, your project in GitHub should look something like this:

Yes I created the database. That’s what the games table is stored in.

The games.csv file is the provided file to translate from csv to sql. The expected _outcome file is how you check to make sure your queries are correct. this is all provided in the initial set up.

Let’s try to solve the problem.
So you’re busy with the World Cup database.
In GitHub at the end of the project you must have the following files:
image
Start by creating the world cup database with its tables and make a " dump " to create the worldcup.sql file.
Complete the insert_data.sh and queries.sh files.
Quite often, the execution permission of these 2 files is lost and you have to reactivate them by: chmod +x insert_data.sh and chmod +x queries.sh.
Two very important things to be aware of:
When you leave the project and leave it in a certain phase, always save it:


When you reopen the project to continue your work where you left off, you will probably notice that the resolved points will be marked in green. Do a reset and the ticks will disappear. Then you rebuild the database and the resolved points will return marked in green:

Be very careful to never save the project before rebuilding the database when none of the completed points are marked with green. You will lose all your work and start over.

Ok first off I really appreciate all the help you’ve given so far so thank you very much.

But I think I’ve isolated it to something going on with my insert_data.sh script. I started the project over by deleting the container and starting from scratch. I rebuilt the database and got the checkmarks to complete.

Then I run my insert_data and while it correctly fills out the table, it suddenly resets my coderoad and no matter what I do (even tho the db and tables are still there and functional) it doesnt recognize any steps as complete anymore. here is my insert_data.sh script

#! /bin/bash

if [[ $1 == "test" ]]
then
  PSQL="psql --username=postgres --dbname=worldcuptest -t --no-align -c"
else
  PSQL="psql --username=freecodecamp --dbname=worldcup -t --no-align -c"
fi

# Do not change code above this line. Use the PSQL variable above to query your database.
cat games.csv | while IFS="," read YEAR ROUND WINNER OPPONENT WINNER_GOALS OPPONENT_GOALS
do
  # Get winner
  if [[ $WINNER != "winner" ]]
  then
    WINNER=$($PSQL "INSERT INTO teams(name) VALUES('$WINNER')")
  fi

  # Get opponent
  if [[ $OPPONENT != "opponent" ]]
  then
    OPPONENT=$($PSQL "INSERT INTO teams(name) VALUES('$OPPONENT')")
  fi
done
cat games.csv | while IFS="," read YEAR ROUND WINNER OPPONENT WINNER_GOALS OPPONENT_GOALS
do
  #get year
  if [[ $YEAR != "year" ]]
  OPPONENT_ID=$($PSQL "SELECT team_id FROM teams WHERE name = '$OPPONENT'")
  WINNER_ID=$($PSQL "SELECT team_id FROM teams WHERE name = '$WINNER'")
  then
    $($PSQL "INSERT INTO games(year, round, winner_id, opponent_id, winner_goals, opponent_goals) 
    VALUES($YEAR,'$ROUND','$WINNER_ID', '$OPPONENT_ID', $WINNER_GOALS, $OPPONENT_GOALS)")
  fi
done

Am I missing something?