Yeah, I'd calculate it on the server side and then pass the blocked days through the JSON render request. On the client side, put in the results of the client side validation. Overall, you just want to make sure that you're aren't allowing a client to go through a whole event record creation, only to tell them something that you already knew and could have told them from the beginning; that enrollment for that day is already filled.
You could do something like this
class LeaveEvent < ActiveRecord::Base
scope :events_on_date, -> (date) { where('start_time <= ? AND end_time >= ?', date, date).size }
...
end
Then use the scope within the JSON builder.
It looks like it was from where the TokenController was getting parsed.
https://github.com/nsarno/knock/commit/ed467d1e3e70dde5b4a367ac1b73dcf48ae4cebb