class Octo::Ctr
Constants
- NEWSFEED
Type of
Ctr
. Reserved for future use
Public Class Methods
data( enterprise_id, ts = Time.now.floor)
click to toggle source
# File lib/octocore-cassandra/models/enterprise/ctr.rb, line 22 def data( enterprise_id, ts = Time.now.floor) args = { enterprise_id: enterprise_id, ts: ts } res = self.where(args) if res.count > 0 res.first else args.merge!({ value: value_array(15)}) self.new(args).save! end end
value_array(count)
click to toggle source
# File lib/octocore-cassandra/models/enterprise/ctr.rb, line 36 def value_array(count) arr = [] res = [] sum = 0 count.times do |x| temp = rand(10.00..100.00) arr.push(temp) sum = sum + temp end count.times do |x| res.push((arr[x]/sum)*100) end res end