From 8de7dd7c0b803e05858502ee7dd7fa578ec21be0 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 27 Oct 2017 11:56:54 +0630 Subject: [PATCH 1/2] update dining_charge --- app/models/dining_charge.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/dining_charge.rb b/app/models/dining_charge.rb index 46b0f3ee..bfd25efc 100755 --- a/app/models/dining_charge.rb +++ b/app/models/dining_charge.rb @@ -5,6 +5,7 @@ class DiningCharge < ApplicationRecord def self.amount_calculate(dining_charges_obj, checkin , checkout) # note :: the first Charge Block will cost all, the Time rounding block will included in 2nd Charge Block if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil? + block_count = 0 price = 0 minutes = DiningCharge.time_diff(checkout, checkin) free_time = DiningCharge.convert_to_minutes(dining_charges_obj.minimum_free_time.utc.localtime.strftime('%H:%M')) From c8ee0563129626feb3f82803fca3dff2d9d63a8d Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 27 Oct 2017 12:01:07 +0630 Subject: [PATCH 2/2] fix hourly chart --- app/controllers/home_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 24fe58ec..24c4aceb 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -68,7 +68,7 @@ class HomeController < ApplicationController @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() @top_products = Sale.top_products(today) - @hourly_sales = Sale.hourly_sales(today) + @hourly_sales = Sale.hourly_sales(today).sum(:grand_total) # .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p') # .sum(:grand_total) @employee_sales = Sale.employee_sales(today).sum(:grand_total)