mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Fix rubocop #2691
This commit is contained in:
parent
f7556f48c8
commit
715e052dcd
2 changed files with 9 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
class Registrar::AccountActivitiesController < RegistrarController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
def index # rubocop: disable Metrics/AbcSize
|
||||
params[:q] ||= {}
|
||||
account = current_user.registrar.cash_account
|
||||
|
||||
|
@ -9,14 +9,18 @@ class Registrar::AccountActivitiesController < RegistrarController
|
|||
begin
|
||||
end_time = params[:q][:created_at_lteq].try(:to_date)
|
||||
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
||||
rescue; end
|
||||
rescue
|
||||
logger.warn('Invalid date')
|
||||
end
|
||||
|
||||
@q = account.activities.includes(:invoice).search(params[:q])
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
|
||||
respond_to do |format|
|
||||
format.html { @account_activities = @q.result.page(params[:page]) }
|
||||
format.csv { send_data @q.result.to_csv, filename: "account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv" }
|
||||
format.csv do
|
||||
send_data @q.result.to_csv, filename: "account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv"
|
||||
end
|
||||
end
|
||||
|
||||
params[:q][:created_at_lteq] = ca_cache
|
||||
|
|
|
@ -25,8 +25,8 @@ class AccountActivity < ActiveRecord::Base
|
|||
CSV.generate(headers: true) do |csv|
|
||||
csv << %w(description activity_type receipt_date sum)
|
||||
|
||||
all.each do |x|
|
||||
csv << attributes.map{ |attr| x.send(attr) }
|
||||
all.find_each do |x|
|
||||
csv << attributes.map { |attr| x.send(attr) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue