diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/call_history.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/call_history.rb b/app/models/call_history.rb index 4db056a..81342bd 100644 --- a/app/models/call_history.rb +++ b/app/models/call_history.rb @@ -3,6 +3,9 @@ class CallHistory < ActiveRecord::Base belongs_to :caller_account, :polymorphic => true belongs_to :callee_account, :polymorphic => true belongs_to :auth_account, :polymorphic => true + + validates :start_stamp, + :presence => true def display_number if self.entry_type == 'dialed' @@ -78,10 +81,11 @@ class CallHistory < ActiveRecord::Base end def display_call_date(date_format, date_today_format) - if self.start_stamp.strftime('%Y%m%d') == DateTime::now.strftime('%Y%m%d') + if self.start_stamp.to_date == Date.today return self.start_stamp.strftime(date_today_format) + else + return self.start_stamp.strftime(date_format) end - return self.start_stamp.strftime(date_format) end def display_duration @@ -129,6 +133,14 @@ class CallHistory < ActiveRecord::Base end + def voicemail_message? + begin + return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).any? + rescue + return nil + end + end + def voicemail_message begin return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first |