From baa1ce5fbc2dd346d76a6fd4a9a3be073fb94b65 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 30 Jun 2017 13:55:26 +0630 Subject: [PATCH] fix date function for shift sale --- app/models/shift_sale.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index a897de2b..5d459f09 100644 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -21,7 +21,7 @@ class ShiftSale < ApplicationRecord #find open shift where is open today and is not closed and login by current cashier today_date = DateTime.now.strftime("%Y-%m-%d") puts today_date - shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}", today_date).take + shift = ShiftSale.where("Date(shift_started_at)=#{today_date} and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take return shift #end