pr check and send email

This commit is contained in:
呱呱呱
2023-08-08 16:27:54 +08:00
parent 5fb8c7739f
commit e3b3dacde7
16 changed files with 359 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
class Admins::GlccExamineMaterial < ApplicationQuery
include CustomSortable
attr_reader :params
sort_columns :created_on, default_direction: :desc
def initialize(params)
@params = params
end
def call
materials = GlccMediumTermExamineMaterial.all
# term
term = params[:term] || [1,2]
if term.present?
materials = materials.where(term: term)
end
#year
year = if params[:date]
params[:date][:year]
end
year = year || Time.now.year
date = Time.now.change(year:year)
materials = materials.where(created_on: [date.beginning_of_year..date.end_of_year])
custom_sort(materials, params[:sort_by], params[:sort_direction])
end
end