app/models/polymorphic/task.rb in fat_free_crm-0.15.2 vs app/models/polymorphic/task.rb in fat_free_crm-0.16.0
- old
+ new
@@ -110,11 +110,11 @@
has_fields
exportable
validates_presence_of :user
validates_presence_of :name, message: :missing_task_name
- validates_presence_of :calendar, if: "self.bucket == 'specific_time' && !self.completed_at"
+ validates_presence_of :calendar, if: -> { self.bucket == 'specific_time' && !self.completed_at }
validate :specific_time, unless: :completed?
before_create :set_due_date
before_update :set_due_date, unless: :completed?
before_save :notify_assignee
@@ -207,23 +207,23 @@
private
#----------------------------------------------------------------------------
def set_due_date
self.due_at = case bucket
- when "overdue"
- due_at || Time.zone.now.midnight.yesterday
- when "due_today"
- Time.zone.now.midnight
- when "due_tomorrow"
- Time.zone.now.midnight.tomorrow
- when "due_this_week"
- Time.zone.now.end_of_week
- when "due_next_week"
- Time.zone.now.next_week.end_of_week
- when "due_later"
- Time.zone.now.midnight + 100.years
- when "specific_time"
- calendar ? parse_calendar_date : nil
+ when "overdue"
+ due_at || Time.zone.now.midnight.yesterday
+ when "due_today"
+ Time.zone.now.midnight
+ when "due_tomorrow"
+ Time.zone.now.midnight.tomorrow
+ when "due_this_week"
+ Time.zone.now.end_of_week
+ when "due_next_week"
+ Time.zone.now.next_week.end_of_week
+ when "due_later"
+ Time.zone.now.midnight + 100.years
+ when "specific_time"
+ calendar ? parse_calendar_date : nil
end
end
#----------------------------------------------------------------------------
def due_end_of_day?