fix – appointment limit calculation

Supportfix – appointment limit calculation
mjch Staff asked 4 years ago
Hi - we found a problem where adding attendee limits for services was behaving badly.  There is an SQL logic issue in get_attendants_number_for_period() which should have an extra group_start()/group_end() pair and read: public function get_attendants_number_for_period(DateTime $slot_start, DateTime $slot_end, $service_id)
{
return (int)$this->db
->select('count(*) AS attendants_number')
->from('ea_appointments')
->group_start()
->group_start()
->where('start_datetime <=', $slot_start->format('Y-m-d H:i:s'))
->where('end_datetime >', $slot_start->format('Y-m-d H:i:s'))
->group_end()
->or_group_start()
->where('start_datetime <', $slot_end->format('Y-m-d H:i:s'))
->where('end_datetime >=', $slot_end->format('Y-m-d H:i:s'))
->group_end()
->group_end()
->where('id_services', $service_id)
->get()
->row()
->attendants_number;
} Regards,
Malcolm
1 Answers
Best Answer
Nikola Loncar Staff answered 4 years ago
Hi, thanks for that. I will see to test it and if it is ok it will be part of next version of EA :) Best regards, Nikola