Skip to content

Commit

Permalink
Simplify filter
Browse files Browse the repository at this point in the history
  • Loading branch information
squadgazzz committed Jul 16, 2024
1 parent f45174a commit c275939
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions crates/orderbook/src/database/fee_policies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ impl super::Postgres {
let fee_policies = database::fee_policies::fetch(&mut ex, keys_filter).await?;
let quote_order_uids = fee_policies
.iter()
.flat_map(|((_, order_uid), policies)| {
policies.iter().filter_map(|policy| {
matches!(
policy.kind,
database::fee_policies::FeePolicyKind::PriceImprovement
)
.filter_map(|((_, order_uid), policies)| {
policies
.iter()
.any(|policy| {
matches!(
policy.kind,
database::fee_policies::FeePolicyKind::PriceImprovement
)
})
.then_some(*order_uid)
})
})
.unique()
.collect::<Vec<_>>();
Expand Down

0 comments on commit c275939

Please sign in to comment.