Skip to content

Commit

Permalink
fix reports CSV downloading (#1339)
Browse files Browse the repository at this point in the history
* fix reports CSV downloading
  • Loading branch information
dmitry-sinina authored Sep 16, 2023
1 parent a2b932f commit d07f19c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
18 changes: 17 additions & 1 deletion app/admin/reports/customer_traffic_data_by_destinations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,24 @@ def scoped_collection
end
end

# TODO use dedicated decorators for CSV data or show measurement units in header
csv do
parent.csv_columns_by_destination.map { |c| column c }
column :destination_prefix
column :country
column :network
column :calls_count
column :success_calls_count
column :short_calls_count
column :calls_duration
column :customer_calls_duration
column :vendor_calls_duration
column :asr
column :acd
column :origination_cost
column :termination_cost
column :profit
column :first_call_at
column :last_call_at
end

action_item :by_vendors, only: :index do
Expand Down
16 changes: 15 additions & 1 deletion app/admin/reports/customer_traffic_data_by_vendors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,22 @@ def scoped_collection
end
end

# TODO use dedicated decorators for CSV data or show measurement units in header
csv do
parent.csv_columns.map { |c| column c }
column :vendor
column :calls_count
column :success_calls_count
column :short_calls_count
column :calls_duration
column :customer_calls_duration
column :vendor_calls_duration
column :asr
column :acd
column :origination_cost
column :termination_cost
column :profit
column :first_call_at
column :last_call_at
end

action_item :by_destinations, only: :index do
Expand Down
20 changes: 18 additions & 2 deletions app/admin/reports/customer_traffic_data_fulls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,25 @@ def scoped_collection
end
end

# TODO: fix CSV
# TODO use dedicated decorators for CSV data or show measurement units in header
csv do
parent.csv_columns_full.map { |c| column c }
column :destination_prefix
column :vendor
column :country
column :network
column :calls_count
column :success_calls_count
column :short_calls_count
column :calls_duration
column :customer_calls_duration
column :vendor_calls_duration
column :asr
column :acd
column :origination_cost
column :termination_cost
column :profit
column :first_call_at
column :last_call_at
end

# TODO: move items + sidebar to act_as_blabla
Expand Down
16 changes: 15 additions & 1 deletion app/admin/reports/vendor_traffic_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,22 @@ def scoped_collection
end
end

# TODO use dedicated decorators for CSV data or show measurement units in header
csv do
parent.csv_columns.map { |c| column c }
column :customer
column :calls_count
column :success_calls_count
column :short_calls_count
column :calls_duration
column :customer_calls_duration
column :vendor_calls_duration
column :asr
column :acd
column :origination_cost
column :termination_cost
column :profit
column :first_call_at
column :last_call_at
end

sidebar 'Vendor traffic report', priority: 0, only: :index do
Expand Down

0 comments on commit d07f19c

Please sign in to comment.