From c88248281cc683fc9a00eaa15f3ad27dce0e3701 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 12 Jul 2017 10:27:45 +0630 Subject: [PATCH] remove date filter in shift --- app/models/shift_sale.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index c9a05561..b7ce7299 100644 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -18,15 +18,16 @@ class ShiftSale < ApplicationRecord def self.current_shift today_date = DateTime.now.strftime("%Y-%m-%d") - shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null",today_date).take + shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null").take return shift end def self.current_open_shift(current_user) #if current_user #find open shift where is open today and is not closed and login by current cashier + #DATE(shift_started_at)=? and today_date = DateTime.now.strftime("%Y-%m-%d") - shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take + shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take return shift #end end