Skip to content

Commit

Permalink
Remove gcal sync from events_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
andyl committed Oct 28, 2015
1 parent f1ac626 commit 35bfa6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/controllers/eapi/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@ class Eapi::EventsController < ApplicationController
def index
respond_with Event.all, opts
end

def show
respond_with Event.find(params[:id])
end

def create
new_event = Event.create(params[:event])
expire_fragment('event_json_fragment')
broadcast("add", new_event)
ActiveSupport::Notifications.instrument("alert.CreateEvent", {:member => current_member, :tgt => new_event})
QC.enqueue('QcCalendar.csv_resync')
QC.enqueue('QcGcal.create_event_id', new_event.id)
# QC.enqueue('QcCalendar.csv_resync')
# QC.enqueue('QcGcal.create_event_id', new_event.id)
render :json => new_event
end

def update
updated_event = Event.update(params[:id], params[:event])
expire_fragment('event_json_fragment')
broadcast("update", updated_event)
ActiveSupport::Notifications.instrument("alert.UpdateEvent", {:member => current_member, :tgt => updated_event})
QC.enqueue('QcCalendar.csv_resync')
QC.enqueue('QcGcal.update_event_id', updated_event.id)
# QC.enqueue('QcCalendar.csv_resync')
# QC.enqueue('QcGcal.update_event_id', updated_event.id)
respond_with updated_event
end

def destroy
broadcast('destroy')
expire_fragment('event_json_fragment')
ActiveSupport::Notifications.instrument("alert.DeleteEvent", {:member => current_member, :tgt => Event.find(params[:id])})
QC.enqueue('QcCalendar.csv_resync')
QC.enqueue('QcGcal.delete_event', params[:id])
# QC.enqueue('QcCalendar.csv_resync')
# QC.enqueue('QcGcal.delete_event', params[:id])
respond_with Event.destroy(params[:id])
end

Expand Down
2 changes: 2 additions & 0 deletions app/models/qc_gcal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ def self.update_event_id(id)
end

def self.update_event(action)
return
return puts("can't update operation") if action.typ == "operation"
delete_event(action.id)
create_event(action)
end

def self.delete_event(id)
return
timestamp = Time.now.strftime("%m-%d %H:%M:%S")
gcal_service = authenticate_and_return_gcal_service
gcal_events = Event.find(gcal_service, "BE#{id}")
Expand Down

0 comments on commit 35bfa6b

Please sign in to comment.