DanteA-tech / student

MIT License
0 stars 0 forks source link

Data Structure #4

Open DanteA-tech opened 2 months ago

DanteA-tech commented 2 months ago

Background

What my main project was last try was a way to save clash royale cards to specific users using a already existing database of cards. The user can favorite the cards to their user id and is able to view them separately. For machine learning, I found it hard to try and make a project based on clash royale so me and my group members decided to make a switch over to sports with me choosing soccer.

Collections

Screen Shot 2024-04-18 at 11 52 12 AM

Image

I have two different forms of collections, with the first one being a database with all of clash royale cards and their individual information, and the second one is the user's id with the id of the unique cards that they favorited.

Image

The code used creates the table for the favorites shown above with the columns being user id and favorited cards id.

Lists and Dictionaries

The list of the the favorited cards is extracted on the left with the different ids of the cards favorited appearing in the database.

I created two demo dictionaries with different valid Clash Royale cards in them and as you see they show up on the left

APIs and JSON

This is how the post request should be structured for determining the winners between two teams.

Outputted percent chances out of 100 that each team has of winning.

Error 400 when missing team

Screen Shot 2024-04-17 at 8 13 05 PM

Error 400 with duplicate teams

Screen Shot 2024-04-17 at 8 12 51 PM

Both of these error 404s are prompted with the accurate error response based on the error that the user makes.

image

Using a user that does not exist we get a error 404 about the user not being found.

Frontend

image

This fetches the API endpoint where the cards that the user favorited are stored and are then fetched then sent to the front end in order to be displayed.

Screen Shot 2024-04-17 at 8 50 13 PM

This shows success with loading the cards since they would all show up onto the user's screen allowing them to favorite them.

Screen Shot 2024-04-17 at 8 54 00 PM

If there is an error with favoriting the cards this code uses a catch statement that sends an alert and a console error that there was an error with favoriting the cards.

Optional/Extra, Algorithm Analysis

AdityaSamavedam commented 2 months ago

1.91/2 Your write-up is very detailed and I like how you explained each step. It's very easy to follow and you've answered all the questions very well. I also like the idea of Clash Royale for your project. However, it would have been better if your write-up was in a Jekyll blog with utterance comments instead of an issue. Your formatting is also very good,

Overall, excellent job !! 👏 🔥