Class: Users::ActivityServices
- Inherits:
-
Lesli::ApplicationLesliService
- Object
- Lesli::ApplicationLesliService
- Users::ActivityServices
- Defined in:
- app/services/lesli_audit/users/activity_services.rb
Instance Method Summary collapse
-
#index ⇒ Hash
Paginated list of the records.
Instance Method Details
#index ⇒ Hash
Returns Paginated list of the records.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/services/lesli_audit/users/activity_services.rb', line 41 def index #search_string = query[:search].downcase.gsub(" ","%") unless query[:search].blank? activities = ::User::Activity.joins(:user) #activities = activities.where("users.email = ?", query[:filters][:user]) unless query[:filters][:user].blank? #activities = activities.where("field_name like :search or value_from like :search or value_to like: search", { search: "%#{search_string}%"}) unless search_string.blank? activities = activities.select( "users.email", "users.id", :field_name, :value_from, :value_to, :category, Date2.new.date_time.("user_activities") ) .page(query[:pagination][:page]) .per(query[:pagination][:perPage]) .order(created_at: :desc) end |