Class: ReturningCustomers
- Inherits:
-
GraphDecoration
- Object
- GraphDecoration
- ReturningCustomers
- 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
-
#initialize(real_graph) ⇒ ReturningCustomers
constructor
this functionality initialises with the data from the application models.
Methods inherited from GraphDecoration
#doubleChart, #multipleChart, #singleChart
Constructor Details
#initialize(real_graph) ⇒ ReturningCustomers
this functionality initialises with the data from the application models
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/graph_decorator.rb', line 343 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" @cust_new = 0 @customer_return = 0 #@new_customer_count = Member.select("sign_in_count").group_by{|o| o.sign_in_count}.keys @new_customer_count = [] @y_cust_data = Member.all @y_cust_data.each do |cp| @new_customer_count << cp.sign_in_count end @new_customer_count.each do |cust| if cust > 3 @customer_return += 1 else @cust_new += 1 end end @y_data_1 = @cust_new @y_data_2 = @customer_return @x_name = ['Customer Ratio'] @y_data_3 = Member.sum("sign_in_count") end |