Skip to content

Instantly share code, notes, and snippets.

@thomasstr
Last active December 25, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasstr/7025471 to your computer and use it in GitHub Desktop.
Save thomasstr/7025471 to your computer and use it in GitHub Desktop.
def self.validate_hour(p_id, date_selected, a_id, start_at, end_at)
where {
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (from >= start_at) & (from <= end_at) |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (from <= start_at) & (to >= end_at) |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (to >= start_at) & (to < end_at) |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (start_at >= end_at)
}.count()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment