Project #2 - Yet another website cloning

Jeehooh·2022년 10월 19일
0

Projects

목록 보기
2/2
post-thumbnail

Project #2

In project #2, the goal was to perfectly clone the site shown above. "여기어때" is the name of the website and is basically like hotels.com where you go in and reserve stays located specifically in Korea.

The Goals

As a team, our goal was to reproduce the website perfectly, both inside and out. For the front-end developers, the goal was to make the final product look EXACTLY like the original website. For us back-end developers, the objective was to reproduce all the functions that lie hidden within.

The Result

As you can see, the 2 weeks worth of sweat and tears have really paid off. I was super proud of what the team has delivered.

The Struggles

My struggle came with reproducing the countless filters and search functions that came with the website.

These hotels, campsites, motels and other stays have so many different options and honestly I had absolutely no clue on how to come up with a MYSQL query statement to get the results that I had wanted.

So problem #1 was dynamic filtering. Using the "WHERE" clause given in MYSQL and tweaking it so that it would return the data I asked for, and only the things that I asked for.

Problem #2 came with the "search" part of the website. In short, my results for "jeju caravan" and "jejucaravan" were different, whereas the actual website had no problem understanding what the user was looking for and returned the same results for the above search parameters. I haven't figured out how to accomplish that myself, but I will be working on very soon.

New line I picked up

WHERE 1=1 AND ((("null" IN (?))AND(facility_id=facility_id))OR(facility_id IN (?)))

This line of code solved all the problems known to man. It has cured my broken body and mind, and provided me the strength to walk on. I was blind but now I could see.

The line above is a part from a MYSQL query string where it allows the user to filter the data when an input is given, but returns the original list when no values are provided. When no values are provided, you simply set the "undefined" to "null" and it will dynamically filter the data to your desired taste. Therefore, having multiple inner joins in your query string with WHERE clauses can now return the data without errors.

Looking back

It's been a while since the end of this project, but I remember everything as clear as the cloudless autumn sky. I struggled so much in every aspect of the project, and EVERYTHING that I had to tackle was not a familiar face. In the start of the project, all I knew was "SELECT * FROM users" or "INSERT INTO users" but now I can left join, right join, inner join, holy join, evil join and just join tables as I wish, and understand what that means and how the resulting data will return.

It definitely was not easy, but I pushed and pushed my way through. It was totally worth it.

0개의 댓글