latest Aston req from OPT team
This commit is contained in:
@@ -1,2 +1,17 @@
|
||||
class Survey < ApplicationRecord
|
||||
|
||||
def self.search(filter,from,to)
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
keyword = "dining_name LIKE ?","%#{filter}%"
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
survey = Survey.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ?", from,to)
|
||||
query = survey.where(keyword)
|
||||
else
|
||||
where("dining_name LIKE ?", "%#{filter}%")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user