Enum.reduce refactor with multi

I ended up with this:

  defp add_same_price(order, ids) do
    filtered_order_book = get_incomplete_orders(ids, order.command)

    same_price_orders =
      filtered_order_book
      |> Enum.filter(fn x -> Decimal.cmp(x.price, order.price) == :eq and x.id != order.id end)

    %{order: summed_order, multi: multi} =
      Enum.reduce(same_price_orders, %{order: order, multi: Multi.new()}, fn x,
                                                                             %{
                                                                               order: order,
                                                                               multi: multi
                                                                             } ->
        amount_sum = Decimal.add(x.amount, order.amount)

        multi =
          multi
          |> Multi.update(
            x.id,
            LimitOrder.changeset_update_amount_completed(x, %{completed: true, amount: x.amount})
          )

        order = Map.put(order, :amount, amount_sum)
        %{order: order, multi: multi}
      end)

    multi
    |> Multi.update(
      summed_order.id,
      LimitOrder.changeset_update_amount_completed(order, %{
        completed: summed_order.completed,
        amount: summed_order.amount
      })
    )
    |> Repo.transaction()
  end

for some reason the formatting is on the ugly side