Skip to content

Commit 39ba869

Browse files
authored
Merge pull request hernansartorio#38 from kumargugloth/develop
fixes of repeat booking
2 parents 037a1a1 + 8a9f2bb commit 39ba869

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

routes/user.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ router.post('/booking_history_by_time/:id', verifyToken, (req, res, next) => {
21642164
Booking.find({booking_status:{$in:["booked","completed","cancelled"]}, booking_date:{$gte:req.body.fromdate, $lte:req.body.todate},venue_id:req.params.id,start_time:{$gte:req.body.start_time},end_time:{$lte:req.body.end_time},repeat_booking:true}).lean().populate('venue_data','venue').populate('collected_by','name').populate('cancelled_by','name').then(booking=>{
21652165
result = Object.values(combineRepeatSlots(booking))
21662166
let status_filter = result.filter((b)=>b.booking_status === 'cancelled')
2167-
let grouped = _.mapValues(_.groupBy(result, 'group_id'), clist => clist.map(result => _.omit(result, 'multiple_id')));
2167+
let grouped = _.mapValues(_.groupBy(result, 'repeat_id'), clist => clist.map(result => _.omit(result, 'multiple_id')));
21682168
let x = {}
21692169
let finalBookingList = []
21702170
Object.entries(grouped).map(([i,j])=>{
@@ -2215,7 +2215,7 @@ router.post('/booking_history_by_time/:id', verifyToken, (req, res, next) => {
22152215
router.post('/booking_history_by_group_id/:id', verifyToken, (req, res, next) => {
22162216
Booking.find({booking_status:{$in:["booked","cancelled","completed"]},venue_id:req.params.id,group_id:{$in:req.body.group_id},repeat_booking:true,invoice:false}).lean().populate('venue_data','venue').populate('collected_by','name').populate('cancelled_by','name').then(booking=>{
22172217
result = Object.values(combineRepeatSlots(booking))
2218-
let grouped = _.mapValues(_.groupBy(result, 'group_id'), clist => clist.map(result => _.omit(result, 'multiple_id')));
2218+
let grouped = _.mapValues(_.groupBy(result, 'repeat_id'), clist => clist.map(result => _.omit(result, 'multiple_id')));
22192219
let x = {}
22202220
let finalBookingList = []
22212221
Object.entries(grouped).map(([i,j])=>{

0 commit comments

Comments
 (0)