Skip to content

Commit

Permalink
Merge pull request #2276 from internetee/2274-domain-history-filtration
Browse files Browse the repository at this point in the history
Admin: domain history filtration by date fix
  • Loading branch information
vohmar authored Feb 23, 2022
2 parents 72a5e77 + 1944e46 commit d7e94a6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/controllers/admin/domain_versions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def index
where_s += ' AND 1=0' if registrars == []

versions = Version::DomainVersion.includes(:item).where(where_s).order(created_at: :desc, id: :desc)
@q = versions.ransack(params[:q])
@q = versions.ransack(fix_date_params)

@versions = @q.result.page(params[:page])
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
Expand Down Expand Up @@ -77,5 +77,16 @@ def search
def create_where_string(key, value)
" AND object->>'#{key}' ~* '#{value}'"
end

private

def fix_date_params
params_copy = params[:q].deep_dup
if params_copy['created_at_lteq'].present?
params_copy['created_at_lteq'] = Date.parse(params_copy['created_at_lteq']) + 1.day
end

params_copy
end
end
end

0 comments on commit d7e94a6

Please sign in to comment.