Skip to content

Commit

Permalink
Subqueries are even better
Browse files Browse the repository at this point in the history
  • Loading branch information
philippthun committed Oct 4, 2023
1 parent 0b3534e commit e83202d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/fetchers/app_list_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ def filter(message, dataset)
message.stacks
)

dataset = dataset.where(guid: buildpack_lifecycle_data_dataset.map(&:app_guid))
dataset = dataset.where(guid: buildpack_lifecycle_data_dataset.select(:app_guid))
end

if message.requested?(:lifecycle_type)
if message.lifecycle_type == BuildpackLifecycleDataModel::LIFECYCLE_TYPE
dataset = dataset.where(
guid: BuildpackLifecycleDataModel.
where(Sequel.~(app_guid: nil)).
select_map(:app_guid)
select(:app_guid)
)
elsif message.lifecycle_type == DockerLifecycleDataModel::LIFECYCLE_TYPE
dataset = dataset.exclude(
guid: BuildpackLifecycleDataModel.
where(Sequel.~(app_guid: nil)).
select_map(:app_guid)
select(:app_guid)
)
end
end
Expand Down

0 comments on commit e83202d

Please sign in to comment.