DinneK / the-hiding-place

1 stars 0 forks source link

Add API calls, booking page, css, #19

Closed DinneK closed 2 years ago

DinneK commented 2 years ago

I'll take any advise, also, stay awesome!!!

DinneK commented 2 years ago

@hfaerber

INguyen22 commented 2 years ago

you're tests are looking good! i love what you did in the bookings class with how you got the room details. for the filter by date, you want the rooms available. filterRoomsByDate(bookings, date) { console.log({ bookings }); console.log({ date }); const availRoomsByDate = []; bookings.array.forEach((booking) => { if (booking.dateBooked.includes(date)) { <---- instead on includes, you would want not includes since this date would be booked by the user so you want to return the other rooms that are not booked. I had to learn that the hard way. so for example, if on 2022/02/06 there is a room booked by a user and that room number is 9 then the available rooms that should show is 1-8 and 10-25. availRoomsByDate.push(returnRoomDetails(rooms)); } }); it's ok to return an array of available rooms, for dom purposes you would use the iterator method of forEach to display on the dom. When testing just make sure you're using deep equals if your tests is failing when returning the array.

 let me know if i misinterpreted your question and led you astray!