Number Guessing Game - Build a Number Guessing Game

Hi, I have gone over this script several times and cant seem to make these tests pass. I have read over many of the forum posts regarding these issues and none of them seem to be able to correct my issues.

#!/bin/bash
PSQL="psql --username=freecodecamp --dbname=number_guess -t --no-align -c"


secret_number=$(($RANDOM % 1000 + 1))
echo $secret_number

echo "Enter your username:"
read username
username_check=$($PSQL "select username from user_info where username='$username'")


 if [[ -z $username_check ]]
 then 
 echo "Welcome, $username! It looks like this is your first time here."
 insert=$($PSQL "insert into user_info(username, games_played, best_game_played) VALUES('$username', 0, 0)")
games_played=0
best_game=0
 else
if [[ $username_check ]]
then
games_played=$($PSQL "select games_played from user_info where username='$username'")
best_game=$($PSQL "select best_game_played from user_info where username='$username'")
echo "Welcome back, $username! You have played $games_played games, and your best game took $best_game guesses."
 
 fi
fi

echo "Guess the secret number between 1 and 1000:"
number_of_guesses=0

 while read guess_attempt
do
if [[ $guess_attempt =~ ^[0-9]+$ ]] && [[ ! -z $guess_attempt  ]] && (( $guess_attempt <= 1000 ))
then
  num_of_guesses=$((number_of_guesses+=1))
  if [[ $guess_attempt = $secret_number ]]
  then
  echo "You guessed it in $number_of_guesses tries. The secret number was $secret_number. Nice job!"
  games_played=$((games_played+=1))
  break
  else
  if [[ $guess_attempt < $secret_number ]]
  then
  echo "It's higher than that, guess again:"
  else
  if [[ $guess_attempt > $secret_number ]]
  then
  echo "It's lower than that, guess again:"
   fi 
  fi
  fi
  else 
  echo "That is not an integer, guess again:"
 fi 

done

if (($best_game==0)) || (( $best_game>$number_of_guesses )) && (($num_of_guesses != 0))
  then
   ($PSQL "update user_info set best_game_played=$num_of_guesses, games_played=$games_played where username='$username'")
  else 
    ($PSQL "update user_info set games_played=$games_played where username='$username'")
    fi

The tests in question are:

  • If that username has been used before, it should print Welcome back, <username>! You have played <games_played> games, and your best game took <best_game> guesses., with <username> being a users name from the database, <games_played> being the total number of games that user has played, and <best_game> being the fewest number of guesses it took that user to win the game

When the secret number is guessed, your script should print You guessed it in <number_of_guesses> tries. The secret number was <secret_number>. Nice job! and finish running

I can post a dump if needed as well. Things seem to be working as intended, the count doesnt include invalid user input, and it seems like the test users are being entered in just fine. To be clear I have gotten rid of the additional echo statement used to show what the random secret number is and it did not solve the issue sadly. I only included it to make testing manually easier

--
-- PostgreSQL database dump
--

-- Dumped from database version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)
-- Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE number_guess;
--
-- Name: number_guess; Type: DATABASE; Schema: -; Owner: freecodecamp
--

CREATE DATABASE number_guess WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';


ALTER DATABASE number_guess OWNER TO freecodecamp;

\connect number_guess

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: user_info; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.user_info (
    username character varying(22),
    user_id integer NOT NULL,
    games_played integer,
    best_game_played integer
);


ALTER TABLE public.user_info OWNER TO freecodecamp;

--
-- Name: user_info_user_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--

CREATE SEQUENCE public.user_info_user_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_info_user_id_seq OWNER TO freecodecamp;

--
-- Name: user_info_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--

ALTER SEQUENCE public.user_info_user_id_seq OWNED BY public.user_info.user_id;


--
-- Name: user_info user_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.user_info ALTER COLUMN user_id SET DEFAULT nextval('public.user_info_user_id_seq'::regclass);


--
-- Data for Name: user_info; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.user_info VALUES ('b', 1, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054175714', 2, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054175713', 3, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054557012', 4, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054557011', 5, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673055036144', 6, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673055036143', 7, NULL, NULL);
INSERT INTO public.user_info VALUES ('e[Ae[Afde[Af', 8, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056674270', 9, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056674269', 10, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056687072', 11, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056687071', 12, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056719527', 13, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056719526', 14, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056747657', 15, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056747656', 16, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056831079', 17, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056831078', 18, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056859641', 19, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056859640', 20, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056868076', 21, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056868075', 22, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056877299', 23, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056877298', 24, NULL, NULL);
INSERT INTO public.user_info VALUES ('bp', 25, NULL, NULL);
INSERT INTO public.user_info VALUES ('bpa', 26, NULL, NULL);
INSERT INTO public.user_info VALUES ('re', 27, NULL, NULL);
INSERT INTO public.user_info VALUES ('re', 28, 0, 0);
INSERT INTO public.user_info VALUES ('f', 29, 1, 23);
INSERT INTO public.user_info VALUES ('f', 30, 1, 23);
INSERT INTO public.user_info VALUES ('user_1673059111596', 31, 1, 540);
INSERT INTO public.user_info VALUES ('user_1673059111596', 32, 1, 540);
INSERT INTO public.user_info VALUES ('user_1673059111595', 33, 1, 760);
INSERT INTO public.user_info VALUES ('user_1673059111595', 34, 1, 760);
INSERT INTO public.user_info VALUES ('t', 35, 1, 2);
INSERT INTO public.user_info VALUES ('t', 36, 1, 2);
INSERT INTO public.user_info VALUES ('d', 37, 0, 0);
INSERT INTO public.user_info VALUES ('d', 38, 0, 0);
INSERT INTO public.user_info VALUES ('Brandon Pinkston', 51, 1, 0);
INSERT INTO public.user_info VALUES ('user_1673062588211', 91, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061278171', 70, 2, 43);
INSERT INTO public.user_info VALUES ('user_1673059482613', 41, 2, 852);
INSERT INTO public.user_info VALUES ('user_1673061770293', 81, 5, 102);
INSERT INTO public.user_info VALUES ('user_1673059482614', 40, 5, 423);
INSERT INTO public.user_info VALUES ('user_1673061278172', 69, 5, 198);
INSERT INTO public.user_info VALUES ('user_1673059509954', 43, 2, 870);
INSERT INTO public.user_info VALUES ('mack', 54, 1, 3);
INSERT INTO public.user_info VALUES ('user_1673059509955', 42, 5, 110);
INSERT INTO public.user_info VALUES ('user_1673059556058', 45, 2, 441);
INSERT INTO public.user_info VALUES ('user_1673059556059', 44, 5, 646);
INSERT INTO public.user_info VALUES ('user_1673060754736', 56, 2, 573);
INSERT INTO public.user_info VALUES ('user_1673061588310', 72, 2, 424);
INSERT INTO public.user_info VALUES ('user_1673059603657', 47, 2, 696);
INSERT INTO public.user_info VALUES ('user_1673060754737', 55, 5, 98);
INSERT INTO public.user_info VALUES ('user_1673059603658', 46, 5, 848);
INSERT INTO public.user_info VALUES ('user_1673059810179', 49, 2, 784);
INSERT INTO public.user_info VALUES ('user_1673061588311', 71, 5, 76);
INSERT INTO public.user_info VALUES ('user_1673060818723', 58, 2, 369);
INSERT INTO public.user_info VALUES ('user_1673059810180', 48, 5, 400);
INSERT INTO public.user_info VALUES ('user_1673061979440', 84, 2, 331);
INSERT INTO public.user_info VALUES ('user_1673060818724', 57, 5, 102);
INSERT INTO public.user_info VALUES ('user_1673062594041', 94, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061621128', 74, 2, 190);
INSERT INTO public.user_info VALUES ('user_1673061979441', 83, 5, 23);
INSERT INTO public.user_info VALUES ('user_1673060846709', 60, 2, 146);
INSERT INTO public.user_info VALUES ('user_1673060298113', 53, 2, 311);
INSERT INTO public.user_info VALUES ('user_1673061621129', 73, 5, 168);
INSERT INTO public.user_info VALUES ('user_1673060846710', 59, 5, 452);
INSERT INTO public.user_info VALUES ('user_1673060298114', 52, 5, 133);
INSERT INTO public.user_info VALUES ('user_1673060947798', 62, 2, 242);
INSERT INTO public.user_info VALUES ('user_1673060947799', 61, 5, 235);
INSERT INTO public.user_info VALUES ('user_1673061635339', 76, 2, 308);
INSERT INTO public.user_info VALUES ('user_1673062642686', 102, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061990522', 86, 2, 185);
INSERT INTO public.user_info VALUES ('user_1673060981389', 64, 2, 110);
INSERT INTO public.user_info VALUES ('user_1673061635340', 75, 5, 343);
INSERT INTO public.user_info VALUES ('user_1673060981390', 63, 5, 131);
INSERT INTO public.user_info VALUES ('user_1673062835823', 115, 5, 77);
INSERT INTO public.user_info VALUES ('user_1673062596630', 96, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673060988713', 66, 2, 151);
INSERT INTO public.user_info VALUES ('user_1673061990523', 85, 5, 62);
INSERT INTO public.user_info VALUES ('user_1673061699324', 78, 2, 408);
INSERT INTO public.user_info VALUES ('user_1673060988714', 65, 5, 360);
INSERT INTO public.user_info VALUES ('user_1673062594042', 93, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061699325', 77, 5, 141);
INSERT INTO public.user_info VALUES ('user_1673061165694', 68, 2, 504);
INSERT INTO public.user_info VALUES ('user_1673061165695', 67, 5, 321);
INSERT INTO public.user_info VALUES ('user_1673062570207', 88, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062596631', 95, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061748642', 80, 2, 57);
INSERT INTO public.user_info VALUES ('user_1673062570208', 87, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061748643', 79, 5, 200);
INSERT INTO public.user_info VALUES ('user_1673061770292', 82, 2, 675);
INSERT INTO public.user_info VALUES ('user_1673062691844', 108, 2, 64);
INSERT INTO public.user_info VALUES ('user_1673062585244', 90, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062606486', 98, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062645294', 104, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062642687', 101, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062588210', 92, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062585245', 89, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062813751', 113, 5, 56);
INSERT INTO public.user_info VALUES ('user_1673062606487', 97, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062770745', 112, 2, 593);
INSERT INTO public.user_info VALUES ('user_1673062645295', 103, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062621565', 100, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062691845', 107, 5, 468);
INSERT INTO public.user_info VALUES ('user_1673062621566', 99, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062662821', 106, 2, 88);
INSERT INTO public.user_info VALUES ('user_1673062662822', 105, 5, 139);
INSERT INTO public.user_info VALUES ('user_1673062770746', 111, 5, 19);
INSERT INTO public.user_info VALUES ('user_1673062740450', 110, 2, 791);
INSERT INTO public.user_info VALUES ('user_1673063032763', 117, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062740451', 109, 5, 214);
INSERT INTO public.user_info VALUES ('user_1673063032762', 118, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062813750', 114, 2, 968);
INSERT INTO public.user_info VALUES ('user_1673063041634', 119, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062835822', 116, 2, 10);
INSERT INTO public.user_info VALUES ('user_1673063066807', 121, 5, 168);
INSERT INTO public.user_info VALUES ('user_1673063041633', 120, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673063066806', 122, 2, 841);
INSERT INTO public.user_info VALUES ('2', 50, 0, 3);
INSERT INTO public.user_info VALUES ('user_1673063167063', 123, 5, 156);
INSERT INTO public.user_info VALUES ('user_1673063167062', 124, 2, 332);
INSERT INTO public.user_info VALUES ('v', 39, 18, 1);
INSERT INTO public.user_info VALUES ('user_1673063887783', 125, 5, 148);
INSERT INTO public.user_info VALUES ('user_1673063887782', 126, 2, 175);
INSERT INTO public.user_info VALUES ('user_1673064360482', 129, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673064208620', 127, 5, 126);
INSERT INTO public.user_info VALUES ('user_1673064208619', 128, 2, 119);
INSERT INTO public.user_info VALUES ('user_1673064360481', 130, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673064375201', 131, 5, 14);
INSERT INTO public.user_info VALUES ('user_1673064375200', 132, 2, 695);
INSERT INTO public.user_info VALUES ('user_1673064877286', 133, 5, 133);
INSERT INTO public.user_info VALUES ('user_1673064877285', 134, 2, 95);
INSERT INTO public.user_info VALUES ('user_1673064903989', 135, 5, 288);
INSERT INTO public.user_info VALUES ('user_1673064903988', 136, 2, 669);
INSERT INTO public.user_info VALUES ('user_1673065012080', 138, 2, 150);
INSERT INTO public.user_info VALUES ('user_1673065012081', 137, 5, 231);
INSERT INTO public.user_info VALUES ('user_1673065340845', 140, 2, 419);
INSERT INTO public.user_info VALUES ('user_1673065340846', 139, 5, 391);
INSERT INTO public.user_info VALUES ('user_1673065445359', 142, 0, 4);
INSERT INTO public.user_info VALUES ('user_1673065445360', 141, 0, 4);
INSERT INTO public.user_info VALUES ('user_1673065460313', 143, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065460312', 144, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065486583', 145, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065486582', 146, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065531505', 147, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065531504', 148, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065712394', 150, 2, 306);
INSERT INTO public.user_info VALUES ('user_1673065712395', 149, 5, 111);
INSERT INTO public.user_info VALUES ('user_1673065810422', 152, 2, 477);
INSERT INTO public.user_info VALUES ('user_1673065810423', 151, 5, 409);
INSERT INTO public.user_info VALUES ('user_1673066016187', 154, 2, 102);
INSERT INTO public.user_info VALUES ('user_1673066016188', 153, 5, 583);
INSERT INTO public.user_info VALUES ('user_1673066023947', 156, 2, 125);
INSERT INTO public.user_info VALUES ('user_1673066023948', 155, 5, 45);
INSERT INTO public.user_info VALUES ('user_1673066333553', 158, 2, 566);
INSERT INTO public.user_info VALUES ('user_1673066333554', 157, 5, 157);


--
-- Name: user_info_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--

SELECT pg_catalog.setval('public.user_info_user_id_seq', 158, true);


--
-- Name: user_info user_info_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.user_info
    ADD CONSTRAINT user_info_pkey PRIMARY KEY (user_id);


--
-- PostgreSQL database dump complete
--

--
-- PostgreSQL database dump
--

-- Dumped from database version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)
-- Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE number_guess;
--
-- Name: number_guess; Type: DATABASE; Schema: -; Owner: freecodecamp
--

CREATE DATABASE number_guess WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';


ALTER DATABASE number_guess OWNER TO freecodecamp;

\connect number_guess

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: user_info; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.user_info (
    username character varying(22),
    user_id integer NOT NULL,
    games_played integer,
    best_game_played integer
);


ALTER TABLE public.user_info OWNER TO freecodecamp;

--
-- Name: user_info_user_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--

CREATE SEQUENCE public.user_info_user_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_info_user_id_seq OWNER TO freecodecamp;

--
-- Name: user_info_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--

ALTER SEQUENCE public.user_info_user_id_seq OWNED BY public.user_info.user_id;


--
-- Name: user_info user_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.user_info ALTER COLUMN user_id SET DEFAULT nextval('public.user_info_user_id_seq'::regclass);


--
-- Data for Name: user_info; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.user_info VALUES ('b', 1, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054175714', 2, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054175713', 3, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054557012', 4, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054557011', 5, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673055036144', 6, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673055036143', 7, NULL, NULL);
INSERT INTO public.user_info VALUES ('e[Ae[Afde[Af', 8, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056674270', 9, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056674269', 10, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056687072', 11, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056687071', 12, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056719527', 13, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056719526', 14, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056747657', 15, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056747656', 16, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056831079', 17, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056831078', 18, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056859641', 19, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056859640', 20, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056868076', 21, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056868075', 22, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056877299', 23, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056877298', 24, NULL, NULL);
INSERT INTO public.user_info VALUES ('bp', 25, NULL, NULL);
INSERT INTO public.user_info VALUES ('bpa', 26, NULL, NULL);
INSERT INTO public.user_info VALUES ('re', 27, NULL, NULL);
INSERT INTO public.user_info VALUES ('re', 28, 0, 0);
INSERT INTO public.user_info VALUES ('f', 29, 1, 23);
INSERT INTO public.user_info VALUES ('f', 30, 1, 23);
INSERT INTO public.user_info VALUES ('user_1673059111596', 31, 1, 540);
INSERT INTO public.user_info VALUES ('user_1673059111596', 32, 1, 540);
INSERT INTO public.user_info VALUES ('user_1673059111595', 33, 1, 760);
INSERT INTO public.user_info VALUES ('user_1673059111595', 34, 1, 760);
INSERT INTO public.user_info VALUES ('t', 35, 1, 2);
INSERT INTO public.user_info VALUES ('t', 36, 1, 2);
INSERT INTO public.user_info VALUES ('d', 37, 0, 0);
INSERT INTO public.user_info VALUES ('d', 38, 0, 0);
INSERT INTO public.user_info VALUES ('Brandon Pinkston', 51, 1, 0);
INSERT INTO public.user_info VALUES ('user_1673062588211', 91, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061278171', 70, 2, 43);
INSERT INTO public.user_info VALUES ('user_1673059482613', 41, 2, 852);
INSERT INTO public.user_info VALUES ('user_1673061770293', 81, 5, 102);
INSERT INTO public.user_info VALUES ('user_1673059482614', 40, 5, 423);
INSERT INTO public.user_info VALUES ('user_1673061278172', 69, 5, 198);
INSERT INTO public.user_info VALUES ('user_1673059509954', 43, 2, 870);
INSERT INTO public.user_info VALUES ('mack', 54, 1, 3);
INSERT INTO public.user_info VALUES ('user_1673059509955', 42, 5, 110);
INSERT INTO public.user_info VALUES ('user_1673059556058', 45, 2, 441);
INSERT INTO public.user_info VALUES ('user_1673059556059', 44, 5, 646);
INSERT INTO public.user_info VALUES ('user_1673060754736', 56, 2, 573);
INSERT INTO public.user_info VALUES ('user_1673061588310', 72, 2, 424);
INSERT INTO public.user_info VALUES ('user_1673059603657', 47, 2, 696);
INSERT INTO public.user_info VALUES ('user_1673060754737', 55, 5, 98);
INSERT INTO public.user_info VALUES ('user_1673059603658', 46, 5, 848);
INSERT INTO public.user_info VALUES ('user_1673059810179', 49, 2, 784);
INSERT INTO public.user_info VALUES ('user_1673061588311', 71, 5, 76);
INSERT INTO public.user_info VALUES ('user_1673060818723', 58, 2, 369);
INSERT INTO public.user_info VALUES ('user_1673059810180', 48, 5, 400);
INSERT INTO public.user_info VALUES ('user_1673061979440', 84, 2, 331);
INSERT INTO public.user_info VALUES ('user_1673060818724', 57, 5, 102);
INSERT INTO public.user_info VALUES ('user_1673062594041', 94, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061621128', 74, 2, 190);
INSERT INTO public.user_info VALUES ('user_1673061979441', 83, 5, 23);
INSERT INTO public.user_info VALUES ('user_1673060846709', 60, 2, 146);
INSERT INTO public.user_info VALUES ('user_1673060298113', 53, 2, 311);
INSERT INTO public.user_info VALUES ('user_1673061621129', 73, 5, 168);
INSERT INTO public.user_info VALUES ('user_1673060846710', 59, 5, 452);
INSERT INTO public.user_info VALUES ('user_1673060298114', 52, 5, 133);
INSERT INTO public.user_info VALUES ('user_1673060947798', 62, 2, 242);
INSERT INTO public.user_info VALUES ('user_1673060947799', 61, 5, 235);
INSERT INTO public.user_info VALUES ('user_1673061635339', 76, 2, 308);
INSERT INTO public.user_info VALUES ('user_1673062642686', 102, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061990522', 86, 2, 185);
INSERT INTO public.user_info VALUES ('user_1673060981389', 64, 2, 110);
INSERT INTO public.user_info VALUES ('user_1673061635340', 75, 5, 343);
INSERT INTO public.user_info VALUES ('user_1673060981390', 63, 5, 131);
INSERT INTO public.user_info VALUES ('user_1673062835823', 115, 5, 77);
INSERT INTO public.user_info VALUES ('user_1673062596630', 96, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673060988713', 66, 2, 151);
INSERT INTO public.user_info VALUES ('user_1673061990523', 85, 5, 62);
INSERT INTO public.user_info VALUES ('user_1673061699324', 78, 2, 408);
INSERT INTO public.user_info VALUES ('user_1673060988714', 65, 5, 360);
INSERT INTO public.user_info VALUES ('user_1673062594042', 93, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061699325', 77, 5, 141);
INSERT INTO public.user_info VALUES ('user_1673061165694', 68, 2, 504);
INSERT INTO public.user_info VALUES ('user_1673061165695', 67, 5, 321);
INSERT INTO public.user_info VALUES ('user_1673062570207', 88, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062596631', 95, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061748642', 80, 2, 57);
INSERT INTO public.user_info VALUES ('user_1673062570208', 87, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061748643', 79, 5, 200);
INSERT INTO public.user_info VALUES ('user_1673061770292', 82, 2, 675);
INSERT INTO public.user_info VALUES ('user_1673062691844', 108, 2, 64);
INSERT INTO public.user_info VALUES ('user_1673062585244', 90, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062606486', 98, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062645294', 104, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062642687', 101, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062588210', 92, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062585245', 89, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062813751', 113, 5, 56);
INSERT INTO public.user_info VALUES ('user_1673062606487', 97, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062770745', 112, 2, 593);
INSERT INTO public.user_info VALUES ('user_1673062645295', 103, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062621565', 100, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062691845', 107, 5, 468);
INSERT INTO public.user_info VALUES ('user_1673062621566', 99, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062662821', 106, 2, 88);
INSERT INTO public.user_info VALUES ('user_1673062662822', 105, 5, 139);
INSERT INTO public.user_info VALUES ('user_1673062770746', 111, 5, 19);
INSERT INTO public.user_info VALUES ('user_1673062740450', 110, 2, 791);
INSERT INTO public.user_info VALUES ('user_1673063032763', 117, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062740451', 109, 5, 214);
INSERT INTO public.user_info VALUES ('user_1673063032762', 118, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062813750', 114, 2, 968);
INSERT INTO public.user_info VALUES ('user_1673063041634', 119, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062835822', 116, 2, 10);
INSERT INTO public.user_info VALUES ('user_1673063066807', 121, 5, 168);
INSERT INTO public.user_info VALUES ('user_1673063041633', 120, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673063066806', 122, 2, 841);
INSERT INTO public.user_info VALUES ('2', 50, 0, 3);
INSERT INTO public.user_info VALUES ('user_1673063167063', 123, 5, 156);
INSERT INTO public.user_info VALUES ('user_1673063167062', 124, 2, 332);
INSERT INTO public.user_info VALUES ('v', 39, 18, 1);
INSERT INTO public.user_info VALUES ('user_1673063887783', 125, 5, 148);
INSERT INTO public.user_info VALUES ('user_1673063887782', 126, 2, 175);
INSERT INTO public.user_info VALUES ('user_1673064360482', 129, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673064208620', 127, 5, 126);
INSERT INTO public.user_info VALUES ('user_1673064208619', 128, 2, 119);
INSERT INTO public.user_info VALUES ('user_1673064360481', 130, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673064375201', 131, 5, 14);
INSERT INTO public.user_info VALUES ('user_1673064375200', 132, 2, 695);
INSERT INTO public.user_info VALUES ('user_1673064877286', 133, 5, 133);
INSERT INTO public.user_info VALUES ('user_1673064877285', 134, 2, 95);
INSERT INTO public.user_info VALUES ('user_1673064903989', 135, 5, 288);
INSERT INTO public.user_info VALUES ('user_1673064903988', 136, 2, 669);
INSERT INTO public.user_info VALUES ('user_1673065012080', 138, 2, 150);
INSERT INTO public.user_info VALUES ('user_1673065012081', 137, 5, 231);
INSERT INTO public.user_info VALUES ('user_1673065340845', 140, 2, 419);
INSERT INTO public.user_info VALUES ('user_1673065340846', 139, 5, 391);
INSERT INTO public.user_info VALUES ('user_1673065445359', 142, 0, 4);
INSERT INTO public.user_info VALUES ('user_1673065445360', 141, 0, 4);
INSERT INTO public.user_info VALUES ('user_1673065460313', 143, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065460312', 144, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065486583', 145, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065486582', 146, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065531505', 147, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065531504', 148, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065712394', 150, 2, 306);
INSERT INTO public.user_info VALUES ('user_1673065712395', 149, 5, 111);
INSERT INTO public.user_info VALUES ('user_1673065810422', 152, 2, 477);
INSERT INTO public.user_info VALUES ('user_1673065810423', 151, 5, 409);
INSERT INTO public.user_info VALUES ('user_1673066016187', 154, 2, 102);
INSERT INTO public.user_info VALUES ('user_1673066016188', 153, 5, 583);
INSERT INTO public.user_info VALUES ('user_1673066023947', 156, 2, 125);
INSERT INTO public.user_info VALUES ('user_1673066023948', 155, 5, 45);
INSERT INTO public.user_info VALUES ('user_1673066333553', 158, 2, 566);
INSERT INTO public.user_info VALUES ('user_1673066333554', 157, 5, 157);


--
-- Name: user_info_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--

SELECT pg_catalog.setval('public.user_info_user_id_seq', 158, true);


--
-- Name: user_info user_info_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.user_info
    ADD CONSTRAINT user_info_pkey PRIMARY KEY (user_id);


--
-- PostgreSQL database dump complete
--

Could you share the db dump as well?

--
-- PostgreSQL database dump
--

-- Dumped from database version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)
-- Dumped by pg_dump version 12.9 (Ubuntu 12.9-2.pgdg20.04+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE number_guess;
--
-- Name: number_guess; Type: DATABASE; Schema: -; Owner: freecodecamp
--

CREATE DATABASE number_guess WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';


ALTER DATABASE number_guess OWNER TO freecodecamp;

\connect number_guess

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: user_info; Type: TABLE; Schema: public; Owner: freecodecamp
--

CREATE TABLE public.user_info (
    username character varying(22),
    user_id integer NOT NULL,
    games_played integer,
    best_game_played integer
);


ALTER TABLE public.user_info OWNER TO freecodecamp;

--
-- Name: user_info_user_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--

CREATE SEQUENCE public.user_info_user_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.user_info_user_id_seq OWNER TO freecodecamp;

--
-- Name: user_info_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--

ALTER SEQUENCE public.user_info_user_id_seq OWNED BY public.user_info.user_id;


--
-- Name: user_info user_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.user_info ALTER COLUMN user_id SET DEFAULT nextval('public.user_info_user_id_seq'::regclass);


--
-- Data for Name: user_info; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--

INSERT INTO public.user_info VALUES ('b', 1, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054175714', 2, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054175713', 3, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054557012', 4, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673054557011', 5, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673055036144', 6, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673055036143', 7, NULL, NULL);
INSERT INTO public.user_info VALUES ('e[Ae[Afde[Af', 8, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056674270', 9, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056674269', 10, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056687072', 11, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056687071', 12, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056719527', 13, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056719526', 14, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056747657', 15, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056747656', 16, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056831079', 17, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056831078', 18, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056859641', 19, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056859640', 20, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056868076', 21, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056868075', 22, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056877299', 23, NULL, NULL);
INSERT INTO public.user_info VALUES ('user_1673056877298', 24, NULL, NULL);
INSERT INTO public.user_info VALUES ('bp', 25, NULL, NULL);
INSERT INTO public.user_info VALUES ('bpa', 26, NULL, NULL);
INSERT INTO public.user_info VALUES ('re', 27, NULL, NULL);
INSERT INTO public.user_info VALUES ('re', 28, 0, 0);
INSERT INTO public.user_info VALUES ('f', 29, 1, 23);
INSERT INTO public.user_info VALUES ('f', 30, 1, 23);
INSERT INTO public.user_info VALUES ('user_1673059111596', 31, 1, 540);
INSERT INTO public.user_info VALUES ('user_1673059111596', 32, 1, 540);
INSERT INTO public.user_info VALUES ('user_1673059111595', 33, 1, 760);
INSERT INTO public.user_info VALUES ('user_1673059111595', 34, 1, 760);
INSERT INTO public.user_info VALUES ('t', 35, 1, 2);
INSERT INTO public.user_info VALUES ('t', 36, 1, 2);
INSERT INTO public.user_info VALUES ('d', 37, 0, 0);
INSERT INTO public.user_info VALUES ('d', 38, 0, 0);
INSERT INTO public.user_info VALUES ('Brandon Pinkston', 51, 1, 0);
INSERT INTO public.user_info VALUES ('user_1673062588211', 91, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061278171', 70, 2, 43);
INSERT INTO public.user_info VALUES ('user_1673059482613', 41, 2, 852);
INSERT INTO public.user_info VALUES ('user_1673061770293', 81, 5, 102);
INSERT INTO public.user_info VALUES ('user_1673059482614', 40, 5, 423);
INSERT INTO public.user_info VALUES ('user_1673061278172', 69, 5, 198);
INSERT INTO public.user_info VALUES ('user_1673059509954', 43, 2, 870);
INSERT INTO public.user_info VALUES ('mack', 54, 1, 3);
INSERT INTO public.user_info VALUES ('user_1673059509955', 42, 5, 110);
INSERT INTO public.user_info VALUES ('user_1673059556058', 45, 2, 441);
INSERT INTO public.user_info VALUES ('user_1673059556059', 44, 5, 646);
INSERT INTO public.user_info VALUES ('user_1673060754736', 56, 2, 573);
INSERT INTO public.user_info VALUES ('user_1673061588310', 72, 2, 424);
INSERT INTO public.user_info VALUES ('user_1673059603657', 47, 2, 696);
INSERT INTO public.user_info VALUES ('user_1673060754737', 55, 5, 98);
INSERT INTO public.user_info VALUES ('user_1673059603658', 46, 5, 848);
INSERT INTO public.user_info VALUES ('user_1673059810179', 49, 2, 784);
INSERT INTO public.user_info VALUES ('user_1673061588311', 71, 5, 76);
INSERT INTO public.user_info VALUES ('user_1673060818723', 58, 2, 369);
INSERT INTO public.user_info VALUES ('user_1673059810180', 48, 5, 400);
INSERT INTO public.user_info VALUES ('user_1673061979440', 84, 2, 331);
INSERT INTO public.user_info VALUES ('user_1673060818724', 57, 5, 102);
INSERT INTO public.user_info VALUES ('user_1673062594041', 94, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061621128', 74, 2, 190);
INSERT INTO public.user_info VALUES ('user_1673061979441', 83, 5, 23);
INSERT INTO public.user_info VALUES ('user_1673060846709', 60, 2, 146);
INSERT INTO public.user_info VALUES ('user_1673060298113', 53, 2, 311);
INSERT INTO public.user_info VALUES ('user_1673061621129', 73, 5, 168);
INSERT INTO public.user_info VALUES ('user_1673060846710', 59, 5, 452);
INSERT INTO public.user_info VALUES ('user_1673060298114', 52, 5, 133);
INSERT INTO public.user_info VALUES ('user_1673060947798', 62, 2, 242);
INSERT INTO public.user_info VALUES ('user_1673060947799', 61, 5, 235);
INSERT INTO public.user_info VALUES ('user_1673061635339', 76, 2, 308);
INSERT INTO public.user_info VALUES ('user_1673062642686', 102, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061990522', 86, 2, 185);
INSERT INTO public.user_info VALUES ('user_1673060981389', 64, 2, 110);
INSERT INTO public.user_info VALUES ('user_1673061635340', 75, 5, 343);
INSERT INTO public.user_info VALUES ('user_1673060981390', 63, 5, 131);
INSERT INTO public.user_info VALUES ('user_1673062835823', 115, 5, 77);
INSERT INTO public.user_info VALUES ('user_1673062596630', 96, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673060988713', 66, 2, 151);
INSERT INTO public.user_info VALUES ('user_1673061990523', 85, 5, 62);
INSERT INTO public.user_info VALUES ('user_1673061699324', 78, 2, 408);
INSERT INTO public.user_info VALUES ('user_1673060988714', 65, 5, 360);
INSERT INTO public.user_info VALUES ('user_1673062594042', 93, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061699325', 77, 5, 141);
INSERT INTO public.user_info VALUES ('user_1673061165694', 68, 2, 504);
INSERT INTO public.user_info VALUES ('user_1673061165695', 67, 5, 321);
INSERT INTO public.user_info VALUES ('user_1673062570207', 88, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062596631', 95, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061748642', 80, 2, 57);
INSERT INTO public.user_info VALUES ('user_1673062570208', 87, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673061748643', 79, 5, 200);
INSERT INTO public.user_info VALUES ('user_1673061770292', 82, 2, 675);
INSERT INTO public.user_info VALUES ('user_1673062691844', 108, 2, 64);
INSERT INTO public.user_info VALUES ('user_1673062585244', 90, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062606486', 98, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062645294', 104, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062642687', 101, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062588210', 92, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062585245', 89, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062813751', 113, 5, 56);
INSERT INTO public.user_info VALUES ('user_1673062606487', 97, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062770745', 112, 2, 593);
INSERT INTO public.user_info VALUES ('user_1673062645295', 103, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062621565', 100, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062691845', 107, 5, 468);
INSERT INTO public.user_info VALUES ('user_1673062621566', 99, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062662821', 106, 2, 88);
INSERT INTO public.user_info VALUES ('user_1673062662822', 105, 5, 139);
INSERT INTO public.user_info VALUES ('user_1673062770746', 111, 5, 19);
INSERT INTO public.user_info VALUES ('user_1673062740450', 110, 2, 791);
INSERT INTO public.user_info VALUES ('user_1673063032763', 117, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062740451', 109, 5, 214);
INSERT INTO public.user_info VALUES ('user_1673063032762', 118, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062813750', 114, 2, 968);
INSERT INTO public.user_info VALUES ('user_1673063041634', 119, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673062835822', 116, 2, 10);
INSERT INTO public.user_info VALUES ('user_1673063066807', 121, 5, 168);
INSERT INTO public.user_info VALUES ('user_1673063041633', 120, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673063066806', 122, 2, 841);
INSERT INTO public.user_info VALUES ('2', 50, 0, 3);
INSERT INTO public.user_info VALUES ('user_1673063167063', 123, 5, 156);
INSERT INTO public.user_info VALUES ('user_1673063167062', 124, 2, 332);
INSERT INTO public.user_info VALUES ('v', 39, 18, 1);
INSERT INTO public.user_info VALUES ('user_1673063887783', 125, 5, 148);
INSERT INTO public.user_info VALUES ('user_1673063887782', 126, 2, 175);
INSERT INTO public.user_info VALUES ('user_1673064360482', 129, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673064208620', 127, 5, 126);
INSERT INTO public.user_info VALUES ('user_1673064208619', 128, 2, 119);
INSERT INTO public.user_info VALUES ('user_1673064360481', 130, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673064375201', 131, 5, 14);
INSERT INTO public.user_info VALUES ('user_1673064375200', 132, 2, 695);
INSERT INTO public.user_info VALUES ('user_1673064877286', 133, 5, 133);
INSERT INTO public.user_info VALUES ('user_1673064877285', 134, 2, 95);
INSERT INTO public.user_info VALUES ('user_1673064903989', 135, 5, 288);
INSERT INTO public.user_info VALUES ('user_1673064903988', 136, 2, 669);
INSERT INTO public.user_info VALUES ('user_1673065012080', 138, 2, 150);
INSERT INTO public.user_info VALUES ('user_1673065012081', 137, 5, 231);
INSERT INTO public.user_info VALUES ('user_1673065340845', 140, 2, 419);
INSERT INTO public.user_info VALUES ('user_1673065340846', 139, 5, 391);
INSERT INTO public.user_info VALUES ('user_1673065445359', 142, 0, 4);
INSERT INTO public.user_info VALUES ('user_1673065445360', 141, 0, 4);
INSERT INTO public.user_info VALUES ('user_1673065460313', 143, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065460312', 144, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065486583', 145, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065486582', 146, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065531505', 147, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065531504', 148, 0, 0);
INSERT INTO public.user_info VALUES ('user_1673065712394', 150, 2, 306);
INSERT INTO public.user_info VALUES ('user_1673065712395', 149, 5, 111);
INSERT INTO public.user_info VALUES ('user_1673065810422', 152, 2, 477);
INSERT INTO public.user_info VALUES ('user_1673065810423', 151, 5, 409);
INSERT INTO public.user_info VALUES ('user_1673066016187', 154, 2, 102);
INSERT INTO public.user_info VALUES ('user_1673066016188', 153, 5, 583);
INSERT INTO public.user_info VALUES ('user_1673066023947', 156, 2, 125);
INSERT INTO public.user_info VALUES ('user_1673066023948', 155, 5, 45);
INSERT INTO public.user_info VALUES ('user_1673066333553', 158, 2, 566);
INSERT INTO public.user_info VALUES ('user_1673066333554', 157, 5, 157);


--
-- Name: user_info_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--

SELECT pg_catalog.setval('public.user_info_user_id_seq', 158, true);


--
-- Name: user_info user_info_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--

ALTER TABLE ONLY public.user_info
    ADD CONSTRAINT user_info_pkey PRIMARY KEY (user_id);


--
-- PostgreSQL database dump complete
--

I’m getting additional UPDATE 1 printed after the game is completed. After removing the printout these test seems to pass most of the time. I wasn’t yet able to pinpoint the other reason for tests failing.

1 Like

Could you share how you happened to get rid of the extra text printing? Did you just send the stdout from those update psql calls to a different file so it didn’t show up? I also found after playing around for a while that if you add a variable name like (insert_into=$($psql etc.) to those last update sql calls that is also made my script check pass maybe 40% of the time. Thanks so much for the reply and help! Youre a lifesave

I assigned it to variable, like:

update=$($PSQL "update user_info set best_game_played=$num_of_guesses, games_played=$games_played where username='$username'")

After registering a new user or welcoming an old one back, , you should only update the table if the person made a correct guess so you need to fix the logic. (Move the code to the block which handles correct guesses). Also simplify it as you probably don’t need an if.

1 Like

Ahhh, this does seem to be the issue, the way I had set it up, everytime the user guesses correctly their info is updated, no new rows are created by the table. I cant think of a way to make that work without an if statement checking the variables to see if the new number_of_guesses is smaller than the currently logged one. The only thing I could think of would be to insert a new row for each attempt and that way I wouldnt have to check I could just use an aggregate psql function like min() to find it for me.

Without the if statement, do you see a way to check currently logged variables against new ones? Thanks so much for the help!

i appended one last if check to make sure that the users guess matches the secret number before it updates the database and it seems to be functioning as expected. Although I cannot check it as I passed the tests already.

if (($best_game==0)) || (( $best_game>$number_of_guesses )) && (($num_of_guesses != 0)) && (($guess_attempt == $secret_number))
  then
   mix=$($PSQL "update user_info set best_game_played=$num_of_guesses, games_played=$games_played where username='$username'")
  else 
    mac=$($PSQL "update user_info set games_played=$games_played where username='$username'")
    fi

Yes you do need an if to figure out if this was the best game, but to me it looked like your condition was more complicated than that. Glad you got it working.

1 Like