Skip to content

Commit

Permalink
misc: Cleanup remaining group logic (getlago#2310)
Browse files Browse the repository at this point in the history
## Context

Related to getlago#2257

## Description

This PR removes some remaining legacy group related logic
  • Loading branch information
vincent-pochet authored and abdussamadbello committed Aug 8, 2024
1 parent 9fbd800 commit be3f897
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/queries/past_usage_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def query
end

def fees_query(invoice)
query = invoice.fees.charge.includes(:charge_filter, :group)
query = invoice.fees.charge.includes(:charge_filter)
return query unless filters.billable_metric_code

query.joins(:charge).where(charges: {billable_metric_id: billable_metric.id})
Expand Down
1 change: 0 additions & 1 deletion app/serializers/v1/invoice_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def fees
:subscription,
:customer,
:charge,
:group,
:billable_metric,
{charge_filter: {values: :billable_metric_filter}}
]
Expand Down
9 changes: 0 additions & 9 deletions app/services/charges/override_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def call
c.properties = params[:properties] if params.key?(:properties)
c.min_amount_cents = params[:min_amount_cents] if params.key?(:min_amount_cents)
c.invoice_display_name = params[:invoice_display_name] if params.key?(:invoice_display_name)
c.group_properties = charge.group_properties.map(&:dup)
c.filters = charge.filters.map do |filter|
f = filter.dup
f.values = filter.values.map(&:dup)
Expand All @@ -27,14 +26,6 @@ def call
end
new_charge.save!

if params.key?(:group_properties)
group_result = GroupProperties::CreateOrUpdateBatchService.call(
charge: new_charge,
properties_params: params[:group_properties]
)
group_result.raise_if_error!
end

if params.key?(:filters)
filters_result = ChargeFilters::CreateOrUpdateBatchService.call(
charge: new_charge,
Expand Down
3 changes: 1 addition & 2 deletions app/services/events/stores/base_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def initialize(code:, subscription:, boundaries:, filters: {})
@subscription = subscription
@boundaries = boundaries

@group = filters[:group]
@grouped_by = filters[:grouped_by]
@grouped_by_values = filters[:grouped_by_values]

Expand Down Expand Up @@ -114,7 +113,7 @@ def sanitize_colon(query)

protected

attr_accessor :code, :subscription, :group, :boundaries, :grouped_by_values, :matching_filters, :ignored_filters
attr_accessor :code, :subscription, :boundaries, :grouped_by_values, :matching_filters, :ignored_filters

delegate :customer, to: :subscription

Expand Down
9 changes: 0 additions & 9 deletions config/locales/en/charge.yml

This file was deleted.

0 comments on commit be3f897

Please sign in to comment.