Skip to content

Commit

Permalink
asdas
Browse files Browse the repository at this point in the history
  • Loading branch information
devamdoshi212 committed Nov 25, 2023
1 parent 01f2904 commit 2796cae
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions Controller/PaymentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,51 +190,44 @@ module.exports.CountOFAllPaymentswithsportwithinstructor = async function (

module.exports.getPaymentTimeslotCount = async (req, res) => {
let sports = req.query.sports;
let sportsComplex = req.query.sports;
let timeSlotFrom = req.query.sports;
let timeSlotTo = req.query.To;
let sportsComplex = req.query.sportsComplex;
let timeSlotFrom = req.query.timeSlotFrom;
let timeSlotTo = req.query.timeSlotTo;
let payment = await PaymentModel.find({
sportsComplexId: "654a07e68d14ca1d77041c04",
sports: "654a743edf5e36e891e63626",
sportsComplexId: sportsComplex,
sports: sports,
});
// let sport = await SportsComplexModel.find({
// _id: "654a07e68d14ca1d77041c04",
// });
//capacity
let capacity = await SportsComplexModel.findOne({_id:sportsComplex}).lean();
let capacity = await SportsComplexModel.findOne({
_id: sportsComplex,
}).lean();
let mycap = 0;
capacity.sports.forEach(ele=>{
if(ele.sport.toString() == sports)
{
capacity.sports.forEach((ele) => {
if (ele.sport.toString() == sports) {
mycap = ele.capacity;
}
})
});
// my cap maa capacity chhe
let paymentdata = [];
payment.forEach((ele) => {
let date = new Date(ele.from);
let day = date.getDate();
console.log("====================================");
console.log(date);
console.log("====================================");
let now = new Date();
let nday = now.getDate();
let nmonth = now.getMonth();
let nyear = now.getFullYear();
let duration = 30 * ele.duration;

if (
ele.timeSlot.from == "10:00 AM" &&
ele.timeSlot.to == "3:00 PM" &&
ele.timeSlot.from == timeSlotFrom &&
ele.timeSlot.to == timeSlotTo &&
(date - now) / 86400000 + duration > 0
) {
paymentdata.push(ele);
}
});
console.log("====================================");
console.log(paymentdata);
console.log("====================================");
console.log(paymentdata.length);

res.json({ data: mycap - paymentdata.length, rcode: 200 });
};

module.exports.getAthletePayments = async (req, res) => {
Expand Down

0 comments on commit 2796cae

Please sign in to comment.