Class: BasicSales

Inherits:
Object
  • Object
show all
Defined in:
lib/sales_and_orders_decorator.rb

Overview

This component class initialises an empty sales array to store the sales details for each docrators

Instance Method Summary collapse

Constructor Details

#initializeBasicSales

initialises an empty array for the decorator



6
7
8
# File 'lib/sales_and_orders_decorator.rb', line 6

def initialize
	@sales_array = []
end

Instance Method Details

#common_methodObject

a common method to define a logic of selecting the datas for the last 24 hours where the products sold in the specific time line.



46
47
48
49
50
51
52
53
# File 'lib/sales_and_orders_decorator.rb', line 46

def common_method
    product_sale.each do |product|
       sale_boolean = product.created_at.between?(Time.now.midnight-1.day,Time.now.midnight)
       if(sale_boolean)
           sales_array << product
       end
       end
end

#nonOfferedSale_counter_methodObject

returns total non offered pizza quantity sold value



41
42
43
# File 'lib/sales_and_orders_decorator.rb', line 41

def nonOfferedSale_counter_method
	return @nonOfferedSale_counter
end

#nonVegCounter_methodObject

returns total non veg pizza quantity sold value



31
32
33
# File 'lib/sales_and_orders_decorator.rb', line 31

def nonVegCounter_method
	return @nonVegCounter
end

#offeredSale_counter_methodObject

returns total offered pizza quantity sold value



36
37
38
# File 'lib/sales_and_orders_decorator.rb', line 36

def offeredSale_counter_method
	return @offeredSale_counter
end

#sales_arrayObject

returns sales array



11
12
13
# File 'lib/sales_and_orders_decorator.rb', line 11

def sales_array
	return @sales_array
end

#totalSale_counter_methodObject

returns total sale value



16
17
18
# File 'lib/sales_and_orders_decorator.rb', line 16

def totalSale_counter_method
	return @totalSale_order
end

#totalSale_quantity_methodObject

returns total quantity sold value



21
22
23
# File 'lib/sales_and_orders_decorator.rb', line 21

def totalSale_quantity_method
	return @totalSale_quantity
end

#vegCounter_methodObject

returns total veg pizza quantity sold value



26
27
28
# File 'lib/sales_and_orders_decorator.rb', line 26

def vegCounter_method
	return @vegCounter
end