ROR Newby

Hi all Im trying to track conflicts in Event Dates. So Im basically checking if event dates overlap

This is the code my boss helped me with however its showing records as overlapping when there is no conflict. Any ideas?

def perform (user_id)

user=User.find(user_id)

events=user.calendar.events

events.each do |e|

overlaps=events.where("(strftime(‘%s’,start) - strftime(‘%s’,?)) * (strftime(‘%s’,?) - strftime(‘%s’,end)) >= 0 ", e.start, e.end)

#exclude event id

if overlaps.any? where.not(“id = e.id”) #something like this

puts “FOUND AN OVERLAP”

end

end

#When using POSTGRES

#events.each do |e|

#e.start

#overlaps=events.where(“(start, end) OVERLAPS (?,?)”, e.start, e.end)

end

Hi Nicole,

you’re not on the mailing list dedicated to help people with using RoR or with their code. This mailing list is about Rails core development, enhancing it, not using it.

You should ask your question on Redirecting to Google Groups.

Hi Nicole,

Also, you can check a group’s “About” to find out the rules for posting, if the group admins have specified any. E.g.:

https://groups.google.com/forum/#!aboutgroup/rubyonrails-core

Good luck!

– Chad