Closed DinneK closed 2 years ago
@hfaerber
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!
Added API Calls
Finished tests in classes
added booking page
Would love a little advise on a filter by date function. I thought I had that figured out, but I realized I'm returning the entire array of rooms, no matter what date I put in.
A little behind on functionality, but getting there.
I'll take any advise, also, stay awesome!!!