fix timezone - time with local timezone to default timezone
This commit is contained in:
@@ -60,7 +60,7 @@ class Booking < ApplicationRecord
|
||||
end
|
||||
|
||||
scope :active, -> { where('booking_status != ?', 'moved') }
|
||||
scope :today, -> { where('created_at >= ?', Time.now) }
|
||||
scope :today, -> { where('created_at >= ?', Time.current) }
|
||||
scope :assign, -> { where(booking_status: 'assign') }
|
||||
|
||||
def self.sync_booking_records(bookings)
|
||||
@@ -128,9 +128,9 @@ class Booking < ApplicationRecord
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
booking = Booking.joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("DATE_FORMAT(bookings.created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(bookings.created_at,'%d-%m-%Y') <= ? and NOT bookings.booking_status = 'void' ", from,to)
|
||||
query = booking.where(keyword)
|
||||
booking = Booking.joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("bookings.created_at BETWEEN ? AND ? and NOT bookings.booking_status = 'void' ", from,to)
|
||||
query = booking.where(keyword)
|
||||
else
|
||||
joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}' OR df.name LIKE ?","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
|
||||
Reference in New Issue
Block a user