mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Merge branch 'master' into fix-for-ransack-deprecated-method
This commit is contained in:
commit
9cafc98482
171 changed files with 1061 additions and 726 deletions
|
@ -3,19 +3,27 @@ module Admin
|
|||
load_and_authorize_resource class: ApiLog::ReppLog
|
||||
before_action :set_default_dates, only: [:index]
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
def index
|
||||
@q = ApiLog::ReppLog.ransack(params[:q])
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
|
||||
@repp_logs = @q.result
|
||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present?
|
||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present?
|
||||
if params[:q][:created_at_gteq].present?
|
||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)",
|
||||
Time.parse(params[:q][:created_at_gteq]))
|
||||
end
|
||||
if params[:q][:created_at_lteq].present?
|
||||
@repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)",
|
||||
Time.parse(params[:q][:created_at_lteq]))
|
||||
end
|
||||
@repp_logs = @repp_logs.page(params[:page])
|
||||
@count = @q.result.count
|
||||
@repp_logs = @repp_logs.per(params[:results_per_page]) if paginate?
|
||||
|
||||
render_by_format('admin/repp_logs/index', 'repp_logs')
|
||||
end
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
def show
|
||||
@repp_log = ApiLog::ReppLog.find(params[:id])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue