diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-26 16:39:27 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-26 16:39:27 +0100 |
commit | 52f6d8691cd014b7dc94f5cc7a9ad8dff8a4b6cf (patch) | |
tree | b2ea7c9274571670439c1907f2f2189afd00f765 /app/models | |
parent | af4a02e15a02481e23f9458ae0a430ec52c57417 (diff) | |
parent | c7b119d19bb866630ce9b152b28308ae3487a77f (diff) |
Merge branch 'call_histories' into develop
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 |