Skip to content

Commit

Permalink
Fix Elixir 1.3 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsamson committed Jun 24, 2016
1 parent 05f0a11 commit 59c1dd4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
23 changes: 16 additions & 7 deletions lib/venue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,24 @@ defmodule Stackfooter.Venue do

def handle_call({:order_status, order_id, account}, from, {num_orders, _, venue, _, closed_orders, open_orders, _stock_quotes} = state) do
spawn(fn ->

order =
open_orders
|> Enum.find(fn order -> order.id == order_id end)
case (open_orders |> Enum.find(fn order -> order.id == order_id end)) do
nil ->
(closed_orders |> Enum.find(fn order -> order.id == order_id end))
ord ->
ord
end

if order == nil do
order =
closed_orders
|> Enum.find(fn order -> order.id == order_id end)
end
# order =
# open_orders
# |> Enum.find(fn order -> order.id == order_id end)
#
# if order == nil do
# order =
# closed_orders
# |> Enum.find(fn order -> order.id == order_id end)
# end

cond do
order_id >= num_orders || order_id < 0 ->
Expand Down
6 changes: 6 additions & 0 deletions test/support/channel_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ defmodule Stackfooter.ChannelCase do
# Ecto.Adapters.SQL.restart_test_transaction(Stackfooter.Repo, [])
# end

:ok = Ecto.Adapters.SQL.Sandbox.checkout(Stackfooter.Repo)

unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Stackfooter.Repo, {:shared, self()})
end

:ok
end
end
4 changes: 2 additions & 2 deletions web/channels/execution_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Stackfooter.ExecutionSocket do
{:ok, req, state}
end

def websocket_info({:execution, execution} = info, req, state) do
def websocket_info({:execution, execution} = _info, req, state) do
resp = case Poison.encode(execution) do
{:ok, encoded} ->
encoded
Expand All @@ -40,7 +40,7 @@ defmodule Stackfooter.ExecutionSocket do
{:reply, {:text, resp}, req, state}
end

def websocket_info(info, req, state) do
def websocket_info(_info, req, state) do
{:ok, req, state}
end

Expand Down
6 changes: 3 additions & 3 deletions web/channels/ticker_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ defmodule Stackfooter.TickerSocket do
end)

case params do
%{"trading_account" => account, "venue" => venue, "stock" => stock} ->
%{"trading_account" => _account, "venue" => venue, "stock" => stock} ->
# Uncomment for documented behavior instead of observed behavior
# PubSub.subscribe Stackfooter.PubSub, self, "tickers:#{account}-#{venue}-#{stock}"
PubSub.subscribe Stackfooter.PubSub, self, "tickers:#{venue}-#{stock}"
%{"trading_account" => account, "venue" => venue} ->
%{"trading_account" => _account, "venue" => venue} ->
# Uncomment for documented behavior instead of observed behavior
# PubSub.subscribe Stackfooter.PubSub, self, "tickers:#{account}-#{venue}"
PubSub.subscribe Stackfooter.PubSub, self, "tickers:#{venue}"
Expand All @@ -34,7 +34,7 @@ defmodule Stackfooter.TickerSocket do
{:ok, req, state}
end

def websocket_info({:ticker, ticker} = info, req, state) do
def websocket_info({:ticker, ticker} = _info, req, state) do
resp = case Poison.encode(ticker) do
{:ok, encoded} ->
encoded
Expand Down
1 change: 0 additions & 1 deletion web/plugs/api/authenticate.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule Stackfooter.Plugs.Api.Authenticate do
use Stackfooter.Web, :controller
alias Stackfooter.ApiKeyRegistry
alias Stackfooter.Repo

def init(options) do
options
Expand Down

0 comments on commit 59c1dd4

Please sign in to comment.