'Calculate the number of reservations for 1 day
I'm stuck on the calculation of the number of reservations made during the day. People can book up to 4 covers, the capacity of the restaurant is 40 covers. I can't check to see if there's room left. I have a sql query to retrieve the reservations for the day, then I block on the reservations for the days to retrieve the number of covers for each reservation. How do I add the number of covers for all the reservations for the day? I'm going to check this on the backend side with nodejs and express js.
Thank you in advance for your help
exports.createReservation = (req,res)=>{
const {numeroReservation, id_user, idBoutique, horaire, dateReservation, nombreCouverts} = req.body;
connection.query(reservation.getAllReservationByIdBoutiqueDateReservation,[idBoutique,dateReservation],(error,result)=>{
for(var i =0,len = result.length; i< len; i++){
const test = result[i].nombreCouverts * result[i].nombreCouverts
console.log(test)
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
