Class: UserNotificationSchedule
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- UserNotificationSchedule
- Defined in:
- app/models/user_notification_schedule.rb
Constant Summary collapse
- DEFAULT =
-> do attrs = { enabled: false } 7.times do |n| attrs["day_#{n}_start_time".to_sym] = 480 attrs["day_#{n}_end_time".to_sym] = 1020 end attrs end.call
Instance Method Summary collapse
Instance Method Details
#create_do_not_disturb_timings(delete_existing: false) ⇒ Object
20 21 22 23 |
# File 'app/models/user_notification_schedule.rb', line 20 def create_do_not_disturb_timings(delete_existing: false) destroy_scheduled_timings if delete_existing UserNotificationScheduleProcessor.create_do_not_disturb_timings_for(self) end |
#destroy_scheduled_timings ⇒ Object
25 26 27 |
# File 'app/models/user_notification_schedule.rb', line 25 def destroy_scheduled_timings user.do_not_disturb_timings.where(scheduled: true).destroy_all end |