remove date filter in shift

This commit is contained in:
Yan
2017-07-12 10:27:45 +06:30
parent 465055aacb
commit c88248281c

View File

@@ -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