# Class: Tgcallhistory

# Public Instance Methods

### thisuser_logincount_today (uid = self.user_id)

Calculates the total login count for a specific user by id in a 24hour period

Show source...

        # File bbs/lib/dbmodels/callhistory.rb, line 90
    90: def thisuser_logincount_today(uid = self.user_id)
    91:   today = 0
    92:   dataset = $db[:callhistory].where(:user_id => uid).filter(:time_login =>(Time.now - 24.hours)..(Time.now))
    93:   return dataset.count
    94: end

### thisuser_time_today (uid = self.user_id)

Calculates the total time a specific user by id has spent in callhistory in a 24hour period

Show source...

        # File bbs/lib/dbmodels/callhistory.rb, line 77
    77: def thisuser_time_today(uid = self.user_id)
    78:   today = 0
    79:   dataset = $db[:callhistory].where(:user_id => uid).filter(:time_login =>(Time.now - 24.hours)..(Time.now))
    80:   dataset.each do |ds|
    81:     unless ds[:time_logout].nil?
    82:       timediff = (ds[:time_logout] - ds[:time_login]).to_i.sec_to_min
    83:       today += timediff
    84:     end #/unless
    85:   end #/do
    86:   return today
    87: end