Class: BasicSales
- Inherits:
-
Object
- Object
- BasicSales
- 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
-
#common_method ⇒ Object
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.
-
#initialize ⇒ BasicSales
constructor
initialises an empty array for the decorator.
-
#nonOfferedSale_counter_method ⇒ Object
returns total non offered pizza quantity sold value.
-
#nonVegCounter_method ⇒ Object
returns total non veg pizza quantity sold value.
-
#offeredSale_counter_method ⇒ Object
returns total offered pizza quantity sold value.
-
#sales_array ⇒ Object
returns sales array.
-
#totalSale_counter_method ⇒ Object
returns total sale value.
-
#totalSale_quantity_method ⇒ Object
returns total quantity sold value.
-
#vegCounter_method ⇒ Object
returns total veg pizza quantity sold value.
Constructor Details
#initialize ⇒ BasicSales
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_method ⇒ Object
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_method ⇒ Object
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_method ⇒ Object
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_method ⇒ Object
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_array ⇒ Object
returns sales array
11 12 13 |
# File 'lib/sales_and_orders_decorator.rb', line 11 def sales_array return @sales_array end |
#totalSale_counter_method ⇒ Object
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_method ⇒ Object
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_method ⇒ Object
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 |