fix date function for shift sale

This commit is contained in:
Yan
2017-06-30 13:55:26 +06:30
parent 34166a1387
commit baa1ce5fbc

View File

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