Created
July 3, 2014 18:16
-
-
Save chriscooning/5653a7b571ff13d9d949 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a = {} | |
| Day.all.map do |day| | |
| a.merge!({day.date => []}) | |
| day.user_schedules.group(:user_id).count.each do |us| | |
| if us[1] > 1 | |
| day.user_schedules.where("user_id = ?", us[0]).each do |uss| | |
| if User.find(us[0]).department_blocks | |
| .where( | |
| "department_blocks.id != ?", uss.department_block.id | |
| ) | |
| .where( | |
| day_id: day.id | |
| ).where( | |
| overlaps_criteria_for_user_schedules(uss.department_block) | |
| ).exists? | |
| a[day.date] << us[0] if a[day.date].last != us[0] | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment