test
This commit is contained in:
@@ -16,6 +16,7 @@ class ShiftSale < ApplicationRecord
|
||||
belongs_to :cashier_terminal
|
||||
belongs_to :employee, :foreign_key => 'employee_id'
|
||||
has_many :sales
|
||||
belongs_to :shop
|
||||
|
||||
def self.current_shift
|
||||
# today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||
@@ -23,12 +24,12 @@ class ShiftSale < ApplicationRecord
|
||||
return shift
|
||||
end
|
||||
|
||||
def self.current_open_shift(current_user)
|
||||
def self.current_open_shift(current_user,shop)
|
||||
#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("shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||
shift = shop.shift_sales.where("shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||
return shift
|
||||
#end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user