diff --git a/lib/components/state-resources/get-available-diary-slots/helpers/generate-time-slots.js b/lib/components/state-resources/get-available-diary-slots/helpers/generate-time-slots.js index a7c3bc4..2c002c3 100644 --- a/lib/components/state-resources/get-available-diary-slots/helpers/generate-time-slots.js +++ b/lib/components/state-resources/get-available-diary-slots/helpers/generate-time-slots.js @@ -5,19 +5,12 @@ const moment = require('moment') module.exports = function generateTimeSlots (diary, inputDate) { const slots = [] - console.log('Inside generate-time-slots') - const date = moment(inputDate).format('YYYY-MM-DD') - console.log('Date selected is ', date) let startTime = moment(date + 'T' + diary.slots.startTime) - console.log('Start time for date is ', startTime) let endTime = moment(date + 'T' + diary.slots.endTime) - console.log('End time for date is ', startTime) while (startTime.isBefore(endTime)) { - console.log('Adding slot ', startTime.format('HH:mm:ss')) slots.push([startTime.format('HH:mm:ss'), 0]) - console.log('Adding to start time ', diary.slots.durationMinutes) startTime.add(diary.slots.durationMinutes, 'm') } diff --git a/lib/components/state-resources/get-available-diary-slots/index.js b/lib/components/state-resources/get-available-diary-slots/index.js index f478744..75a1be3 100644 --- a/lib/components/state-resources/get-available-diary-slots/index.js +++ b/lib/components/state-resources/get-available-diary-slots/index.js @@ -16,13 +16,10 @@ module.exports = class GetAvailableDiarySlots { const diaryService = this.services.diaries const diary = diaryService.diaries[namespace + '_' + this.diaryId] - let entries = await this.entryModel.find({ where: { 'diaryId': { equals: this.diaryId } } }) - console.log('Getting diary entries for ', this.diaryId) + let entries = await this.entryModel.find({where: {'diaryId': {equals: this.diaryId}}}) entries = entries.filter(booking => moment(event.date).format('YYYY-MM-DD') === moment(booking.startDateTime).format('YYYY-MM-DD')) - console.log('Found these entries: ', entries) const availableTimes = getAvailableDiarySlots(diary, event.date) - console.log('These are the available time slots (should appear in app)', availableTimes) const remove = [] @@ -31,7 +28,9 @@ module.exports = class GetAvailableDiarySlots { const d = event.date.split('T')[0] + 'T' + timeSlot[0] if (moment(d).isSame(moment(booking.startDateTime))) { timeSlot[1]++ - if (timeSlot[1] >= diary.slots.maxConcurrency) remove.push(index) + if (timeSlot[1] >= diary.slots.maxConcurrency) { + remove.push(index) + } } })