mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
fixed codeclimate errors
This commit is contained in:
parent
bfa2fcc98c
commit
24d247f4da
1 changed files with 5 additions and 6 deletions
|
@ -33,8 +33,6 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
|
||||||
|
|
||||||
invoices = filter_by_status
|
invoices = filter_by_status
|
||||||
invoices = filter_by_receipt_date(invoices)
|
invoices = filter_by_receipt_date(invoices)
|
||||||
|
|
||||||
|
@ -95,13 +93,14 @@ module Admin
|
||||||
|
|
||||||
def filter_by_receipt_date(invoices)
|
def filter_by_receipt_date(invoices)
|
||||||
if params[:q][:receipt_date_gteq].present?
|
if params[:q][:receipt_date_gteq].present?
|
||||||
invoices = invoices.where(account_activity:
|
date_from = Time.zone.parse(params[:q][:receipt_date_gteq])
|
||||||
{ created_at: Time.parse(params[:q][:receipt_date_gteq])..Float::INFINITY })
|
invoices = invoices.where(account_activity: { created_at: date_from..Float::INFINITY })
|
||||||
end
|
end
|
||||||
|
|
||||||
return invoices unless params[:q][:receipt_date_lteq].present?
|
return invoices if params[:q][:receipt_date_lteq].blank?
|
||||||
|
|
||||||
invoices.where(account_activity: { created_at: -Float::INFINITY..Time.parse(params[:q][:receipt_date_lteq]) })
|
date_until = Time.zone.parse(params[:q][:receipt_date_lteq])
|
||||||
|
invoices.where(account_activity: { created_at: -Float::INFINITY..date_until })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue