Class: ReturningCustomers

Inherits:
GraphDecoration show all
Defined in:
lib/graph_decorator.rb

Overview

a concrete decorator provides the data for the super class decorator according to the requirement of single colum or double column or triple column.

Instance Method Summary collapse

Methods inherited from GraphDecoration

#doubleChart, #multipleChart, #singleChart

Constructor Details

#initialize(real_graph) ⇒ ReturningCustomers

this functionality initialises with the data from the application models



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/graph_decorator.rb', line 222

def initialize(real_graph)
	super(real_graph)
	@y_name_1 = "New Cusomtomers"
       @y_name_2 = "Frequent Customers"
       @y_name_3 = "Total no of sign in count in this website"
       @sum_new = 0
       @sum_old = 0
       @new_customer_count = Member.select("sign_in_count").group_by{|o| o.}.keys
       @new_customer_count.each do |cust|
       	if cust > 3
       		@sum_old+=1
       	else
       		@sum_new+=1
       	end
       end
       @y_data_1 = @sum_new
       @y_data_2 = @sum_old
       @x_name = ['new customer', 'old customer']
       @y_data_3 = Member.sum("sign_in_count")
       
end