getting rid of gruff and it's imagemagic deps. made graphs on stats pending.
This commit is contained in:
parent
403490364a
commit
190daa76dd
7 changed files with 15 additions and 27 deletions
4
Gemfile
4
Gemfile
|
|
@ -43,10 +43,6 @@ gem 'rest-client', '1.6.1'
|
|||
#Backups
|
||||
gem 'cloudfiles', '1.4.10', :require => false
|
||||
|
||||
#Statistics
|
||||
gem 'gruff'
|
||||
gem 'rmagick'
|
||||
|
||||
#Queue
|
||||
gem 'resque', '1.10.0'
|
||||
gem 'SystemTimer', '1.2.1' unless RUBY_VERSION.include? '1.9'
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ GEM
|
|||
gem_plugin (0.2.3)
|
||||
gherkin (2.3.3)
|
||||
json (~> 1.4.6)
|
||||
gruff (0.3.6)
|
||||
haml (3.0.25)
|
||||
hashie (0.4.0)
|
||||
highline (1.6.1)
|
||||
|
|
@ -293,7 +292,6 @@ GEM
|
|||
vegas (~> 0.1.2)
|
||||
rest-client (1.6.1)
|
||||
mime-types (>= 1.16)
|
||||
rmagick (2.13.1)
|
||||
rspec (2.4.0)
|
||||
rspec-core (~> 2.4.0)
|
||||
rspec-expectations (~> 2.4.0)
|
||||
|
|
@ -376,7 +374,6 @@ DEPENDENCIES
|
|||
fastercsv (= 1.5.4)
|
||||
fixture_builder (~> 0.2.0)
|
||||
fog
|
||||
gruff
|
||||
haml (= 3.0.25)
|
||||
http_accept_language!
|
||||
jammit (= 0.5.4)
|
||||
|
|
@ -392,7 +389,6 @@ DEPENDENCIES
|
|||
rails (= 3.0.3)
|
||||
resque (= 1.10.0)
|
||||
rest-client (= 1.6.1)
|
||||
rmagick
|
||||
roxml!
|
||||
rspec (>= 2.0.0)
|
||||
rspec-instafail
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class StatisticsController < ApplicationController
|
|||
|
||||
def show
|
||||
@statistic = Statistic.where(:id => params[:id]).first
|
||||
@distribution = @statistic.distribution_as_array
|
||||
end
|
||||
|
||||
def generate_single
|
||||
|
|
@ -16,11 +17,7 @@ class StatisticsController < ApplicationController
|
|||
end
|
||||
|
||||
def graph
|
||||
@statistic = Statistic.where(:id => params[:id]).first
|
||||
send_data(@statistic.generate_graph,
|
||||
:disposition => 'inline',
|
||||
:type => 'image/png',
|
||||
:filename => "stats.png")
|
||||
# need to use google's graph API
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -40,19 +40,7 @@ class Statistic < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def generate_graph
|
||||
g = Gruff::Bar.new
|
||||
g.title = "Posts per user today"
|
||||
g.data("Users", self.distribution_as_array)
|
||||
|
||||
h = {}
|
||||
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
|
||||
# need to use google's graph API
|
||||
end
|
||||
|
||||
def self.generate(time=Time.now, post_range=(0..50))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,16 @@
|
|||
|
||||
%h3
|
||||
= "Users in sample: #{@statistic.users_in_sample}"
|
||||
= image_tag( "/statistics/graph/#{@statistic.id}")
|
||||
|
||||
%h5
|
||||
(graph implementation pending)
|
||||
|
||||
|
||||
- for pos in (0..@distribution.length-1)
|
||||
%b
|
||||
= pos
|
||||
= @distribution[pos]
|
||||
%br
|
||||
|
||||
%br
|
||||
= link_to 'all statistics', statistics_path
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ describe StatisticsController do
|
|||
|
||||
describe '#graph' do
|
||||
it 'generates a graph' do
|
||||
pending "need to use google graph API"
|
||||
get :graph, :id => @stat.id
|
||||
response.should be_success
|
||||
end
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ describe Statistic do
|
|||
|
||||
describe '#generate_graph' do
|
||||
it 'outputs a binary string' do
|
||||
pending "should use google graph API"
|
||||
@stat.generate_graph.class.should == String
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue