fixed datapoint_spec. fixed labels on graph
This commit is contained in:
parent
46cb9dd346
commit
403490364a
2 changed files with 15 additions and 5 deletions
|
|
@ -45,7 +45,11 @@ class Statistic < ActiveRecord::Base
|
|||
g.data("Users", self.distribution_as_array)
|
||||
|
||||
h = {}
|
||||
distribution.keys.each{|k| h[k.to_i] = k.to_s }
|
||||
distribution.keys.each do |k|
|
||||
if k.to_i%10 ==0
|
||||
h[k.to_i] = k.to_s
|
||||
end
|
||||
end
|
||||
|
||||
g.labels = h
|
||||
g.to_blob
|
||||
|
|
|
|||
|
|
@ -6,18 +6,24 @@ describe DataPoint do
|
|||
@time = Time.now
|
||||
end
|
||||
|
||||
context '.posts_per_day_last_week' do
|
||||
describe '.users_with_posts_on_day' do
|
||||
before do
|
||||
1.times do |n|
|
||||
alice.post(:status_message, :message => 'hi', :to => alice.aspects.first)
|
||||
p = alice.post(:status_message, :message => 'hi', :to => alice.aspects.first)
|
||||
p.created_at = @time
|
||||
p.save
|
||||
end
|
||||
|
||||
5.times do |n|
|
||||
bob.post(:status_message, :message => 'hi', :to => bob.aspects.first)
|
||||
p = bob.post(:status_message, :message => 'hi', :to => bob.aspects.first)
|
||||
p.created_at = @time
|
||||
p.save
|
||||
end
|
||||
|
||||
10.times do |n|
|
||||
eve.post(:status_message, :message => 'hi', :to => eve.aspects.first)
|
||||
p = eve.post(:status_message, :message => 'hi', :to => eve.aspects.first)
|
||||
p.created_at = @time
|
||||
p.save
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue