lib/models/ical_cache.rb
# Return an array of iCal events for today onward
Return an array of iCal events for today onward
Return an array of iCal events for today onward
def upcoming_events
    events = []
    @cache.first.events.each do |event|
      event = (event.occurrences({:starting => Date.today, :count => 1})).first
      if event
        skip = false
        events.reject do |e|
          if e.uid == event.uid
            if e.last_modified < event.last_modified
              true
            else
              skip = true
            end
          else
            false
          end
        end
        events << event if not skip
      end
    end
    events
  end
def upcoming_events events = [ ] @cache . first . events . each do | event | event = ( event . occurrences ( { :starting => Date . today , :count => 1 } ) ) . first if event skip = false events . reject do | e | if e . uid == event . uid if e . last_modified < event . last_modified true else skip = true end else false end end events << event if not skip end end events end
Return an array of iCal events for today onward
Return an array of iCal events for today onward
# Grab the next occurrence for the event # Remove old event if same UID and older modified time # Don't add the new event because it was modified longer ago than current